Ejemplo n.º 1
0
 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"))
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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"))
Ejemplo n.º 7
0
 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])
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 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])
Ejemplo n.º 10
0
 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])
Ejemplo n.º 11
0
 def handle_app(self, app, **options):
     return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')]))