diff --git a/tests/fixtures.py b/tests/fixtures.py index e6e5579..c65d8f4 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -15,6 +15,7 @@ CREATE_TABLE_WITH_NOT_NULL_COLUMN = "app_create_table_with_not_null_column" ADD_NOT_NULL_COLUMN = "app_add_not_null_column" DROP_COLUMN = "app_drop_column" +DROP_TABLE = "app_drop_table" RENAME_COLUMN = "app_rename_column" RENAME_TABLE = "app_rename_table" IGNORE_MIGRATION = "app_ignore_migration" diff --git a/tests/functional/test_migration_linter.py b/tests/functional/test_migration_linter.py index 79172a2..2a3fc55 100644 --- a/tests/functional/test_migration_linter.py +++ b/tests/functional/test_migration_linter.py @@ -61,6 +61,10 @@ class BaseBackwardCompatibilityDetection(object): app = fixtures.DROP_COLUMN self._test_linter_finds_errors(app) + def test_detect_drop_table(self): + app = fixtures.DROP_TABLE + self._test_linter_finds_errors(app) + def test_detect_rename_column(self): app = fixtures.RENAME_COLUMN self._test_linter_finds_errors(app) diff --git a/tests/test_project/app_drop_table/__init__.py b/tests/test_project/app_drop_table/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project/app_drop_table/apps.py b/tests/test_project/app_drop_table/apps.py new file mode 100644 index 0000000..edbc28d --- /dev/null +++ b/tests/test_project/app_drop_table/apps.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class AppDropTableConfig(AppConfig): + name = "tests.test_project.app_drop_table" diff --git a/tests/test_project/app_drop_table/migrations/0001_initial.py b/tests/test_project/app_drop_table/migrations/0001_initial.py new file mode 100644 index 0000000..1d2c279 --- /dev/null +++ b/tests/test_project/app_drop_table/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-04-14 14:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="A", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("field_a", models.IntegerField()), + ], + ) + ] diff --git a/tests/test_project/app_drop_table/migrations/0002_delete_a.py b/tests/test_project/app_drop_table/migrations/0002_delete_a.py new file mode 100644 index 0000000..97e5d9a --- /dev/null +++ b/tests/test_project/app_drop_table/migrations/0002_delete_a.py @@ -0,0 +1,16 @@ +# Generated by Django 2.1.10 on 2019-07-19 09:50 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('app_drop_table', '0001_initial'), + ] + + operations = [ + migrations.DeleteModel( + name='A', + ), + ] diff --git a/tests/test_project/app_drop_table/migrations/__init__.py b/tests/test_project/app_drop_table/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_project/app_drop_table/models.py b/tests/test_project/app_drop_table/models.py new file mode 100644 index 0000000..7f441fe --- /dev/null +++ b/tests/test_project/app_drop_table/models.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models + + +# class A(models.Model): +# field_a = models.IntegerField() diff --git a/tests/test_project/settings.py b/tests/test_project/settings.py index b30a7dd..723bbef 100644 --- a/tests/test_project/settings.py +++ b/tests/test_project/settings.py @@ -47,6 +47,7 @@ INSTALLED_APPS = [ "tests.test_project.app_correct", "tests.test_project.app_create_table_with_not_null_column", "tests.test_project.app_drop_column", + "tests.test_project.app_drop_table", "tests.test_project.app_ignore_migration", "tests.test_project.app_rename_column", "tests.test_project.app_rename_table",