Code used to create the tables. 

Not entirely sure about the foreign keys; probably need to be dropped and re-added.