Add failing tests for unique_together condition
This commit is contained in:
1 parent
8aac58abbe
commit
652031ce8d
2 files changed
+25
No files matched your search
@@ -85,6 +85,10 @@ class BaseBackwardCompatibilityDetection(object):
|
|||||||
app = fixtures.ALTER_COLUMN
|
app = fixtures.ALTER_COLUMN
|
||||||
self._test_linter_finds_no_errors(app)
|
self._test_linter_finds_no_errors(app)
|
||||||
|
|
||||||
|
def test_drop_unique_together(self):
|
||||||
|
app = fixtures.DROP_UNIQUE_TOGETHER
|
||||||
|
self._test_linter_finds_errors(app)
|
||||||
|
|
||||||
def test_accept_alter_column_drop_not_null(self):
|
def test_accept_alter_column_drop_not_null(self):
|
||||||
app = fixtures.ALTER_COLUMN_DROP_NOT_NULL
|
app = fixtures.ALTER_COLUMN_DROP_NOT_NULL
|
||||||
self._test_linter_finds_no_errors(app)
|
self._test_linter_finds_no_errors(app)
|
||||||
|
|||||||
@@ -62,6 +62,13 @@ class MySqlAnalyserTestCase(SqlAnalyserTestCase):
|
|||||||
]
|
]
|
||||||
self.assertValidSql(sql)
|
self.assertValidSql(sql)
|
||||||
|
|
||||||
|
def test_unique_together(self):
|
||||||
|
sql = "ALTER TABLE `app_unique_together_a` ADD CONSTRAINT `app_unique_together_a_int_field_char_field_979ac7d8_uniq` UNIQUE (`int_field`, `char_field`);"
|
||||||
|
self.assertBackwardIncompatibleSql(sql)
|
||||||
|
|
||||||
|
sql = "ALTER TABLE `app_unique_together_a` DROP INDEX `app_unique_together_a_int_field_char_field_979ac7d8_uniq`;"
|
||||||
|
self.assertValidSql(sql)
|
||||||
|
|
||||||
|
|
||||||
class SqliteAnalyserTestCase(SqlAnalyserTestCase):
|
class SqliteAnalyserTestCase(SqlAnalyserTestCase):
|
||||||
database_vendor = "sqlite"
|
database_vendor = "sqlite"
|
||||||
@@ -110,6 +117,13 @@ class SqliteAnalyserTestCase(SqlAnalyserTestCase):
|
|||||||
]
|
]
|
||||||
self.assertValidSql(sql)
|
self.assertValidSql(sql)
|
||||||
|
|
||||||
|
def test_unique_together(self):
|
||||||
|
sql = 'CREATE UNIQUE INDEX "app_unique_together_a_int_field_char_field_979ac7d8_uniq" ON "app_unique_together_a" ("int_field", "char_field");'
|
||||||
|
self.assertBackwardIncompatibleSql(sql)
|
||||||
|
|
||||||
|
sql = 'DROP INDEX "app_unique_together_a_int_field_char_field_979ac7d8_uniq";'
|
||||||
|
self.assertValidSql(sql)
|
||||||
|
|
||||||
|
|
||||||
class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
|
class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
|
||||||
database_vendor = "postgresql"
|
database_vendor = "postgresql"
|
||||||
@@ -129,3 +143,10 @@ class PostgresqlAnalyserTestCase(SqlAnalyserTestCase):
|
|||||||
def test_drop_not_null(self):
|
def test_drop_not_null(self):
|
||||||
sql = 'ALTER TABLE "app_alter_column_drop_not_null_a" ALTER COLUMN "not_null_field" DROP NOT NULL;'
|
sql = 'ALTER TABLE "app_alter_column_drop_not_null_a" ALTER COLUMN "not_null_field" DROP NOT NULL;'
|
||||||
self.assertValidSql(sql)
|
self.assertValidSql(sql)
|
||||||
|
|
||||||
|
def test_unique_together(self):
|
||||||
|
sql = 'ALTER TABLE "app_unique_together_a" ADD CONSTRAINT "app_unique_together_a_int_field_char_field_979ac7d8_uniq" UNIQUE ("int_field", "char_field");'
|
||||||
|
self.assertBackwardIncompatibleSql(sql)
|
||||||
|
|
||||||
|
sql = 'ALTER TABLE "app_unique_together_a" DROP CONSTRAINT "app_unique_together_a_int_field_char_field_979ac7d8_uniq";'
|
||||||
|
self.assertValidSql(sql)
|
||||||
Reference in new issue
Block a user