def action_reset(self, options, args): """Reset the model tables. Use with care, will drop all the tables. """ if not options.force: ans = raw_input(""" Be careful, all the tables of database %r will be dropped. All the data stored in the database will be lost too. Are you sure about this action? (y/N): """ % settings.DATABASE_NAME) if ans.lower() != 'y': return models, __pending = self.get_models() models.reverse() try: for model in models: if options.verbose: print "Drop table %r" % model._meta.table database.drop_table(model) except: database.rollback() raise else: database.commit() self.action_sync(options, args)
def test_drop_table(self): if settings.DATABASE_ENGINE == "gae": return database.drop_table(Comment) self.assertFalse(database.exists_table(Comment)) database.create_table(Comment)