Example #1
0
 def drop_tables(cls):
     models = BaseModel.all_models(cls)
     for model in models:
         table = model._meta.db_table
         try:
             model.drop_table(cascade=True)
             logger.debug('Destroyed table: %s', table)
         except (ProgrammingError, OperationalError):
             logger.warn('Attempted to destroy non-existent table: %s', table)
Example #2
0
 def create_tables(cls):
     models = BaseModel.all_models(cls)
     for model in models:
         table = model._meta.db_table
         try:
             model.create_table()
             logger.debug('Created table: %s', table)
         except ProgrammingError:
             logger.warn('Attempted to create existing table: %s', table)