def test_sql_destroy_indexes(self): app = models.get_app('commands_sql') output = sql_destroy_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates two indexes self.assertIn(len(output), [1, 2]) self.assertTrue(output[0].startswith("DROP INDEX"))
def test_sql_destroy_indexes(self): app_config = apps.get_app_config('commands_sql') output = sql_destroy_indexes(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) # Number of indexes is backend-dependent self.assertTrue(1 <= self.count_ddl(output, 'DROP INDEX') <= 4)
def test_sql_destroy_indexes(self): app_config = apps.get_app_config('commands_sql') output = sql_destroy_indexes(app_config, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates one additional index for CharField self.assertIn(self.count_ddl(output, 'DROP INDEX'), [3, 4])
def handle_app_config(self, app_config, **options): if app_config.models_module is None: return connection = connections[options['database']] statements = sql_destroy_indexes(app_config, self.style, connection) return '\n'.join(statements)
def test_sql_destroy_indexes(self): app = models.get_app("commands_sql") output = sql_destroy_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates two indexes self.assertIn(len(output), [1, 2]) self.assertTrue(output[0].startswith("DROP INDEX"))
def test_sql_destroy_indexes(self): app_config = apps.get_app_config('commands_sql_migrations') with self.assertRaises(CommandError): sql_destroy_indexes(app_config, no_style(), connections[DEFAULT_DB_ALIAS])
def test_sql_destroy_indexes(self): app = app_cache.get_app_config('commands_sql').models_module output = sql_destroy_indexes(app, no_style(), connections[DEFAULT_DB_ALIAS]) # PostgreSQL creates one additional index for CharField self.assertIn(self.count_ddl(output, 'DROP INDEX'), [3, 4])
def handle_app(self, app, **options): return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')]))