コード例 #1
0
 def test_create_tables_for_concrete_models(self, database):
     drop_tables()
     create_tables()
     # noinspection PyProtectedMember
     concrete_models = {
         model._meta.table_name
         for model in Base.get_concrete_descendants()
     }
     assert set(database.get_tables()) == concrete_models
コード例 #2
0
def drop_tables():
    for descendant in Base.get_concrete_descendants():
        if descendant.table_exists():
            descendant.drop_table()
コード例 #3
0
def create_tables():
    for descendant in Base.get_concrete_descendants():
        descendant.create_table()