Add foreign keys to makedb.py