Sort models before createTables and dropTables

This does a topological sort on the globalMetaModels before creating
and dropping tables, such that tables are manipulated in a deterministic
order according to their foreign relations