예제 #1
0
파일: tests.py 프로젝트: cuerty/django
 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"))
예제 #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)
예제 #3
0
파일: tests.py 프로젝트: yellowcap/django
 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)
예제 #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)
예제 #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"))
예제 #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])
예제 #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)
예제 #9
0
파일: tests.py 프로젝트: Alagong/django
 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])
예제 #10
0
파일: tests.py 프로젝트: paul80/410Lab6
 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])
예제 #11
0
 def handle_app(self, app, **options):
     return '\n'.join(sql_destroy_indexes(app, self.style, connections[options.get('database')]))