add testcase for DROP NOT NULL
This commit is contained in:
1 parent
cb5d3991ee
commit
5e2c7bbfaf
12 files changed
+69
No files matched your search
@@ -20,3 +20,4 @@ RENAME_TABLE = "app_rename_table"
|
||||
IGNORE_MIGRATION = "app_ignore_migration"
|
||||
ADD_NOT_NULL_COLUMN_FOLLOWED_BY_DEFAULT = "app_add_not_null_column_followed_by_default"
|
||||
ALTER_COLUMN = "app_alter_column"
|
||||
ALTER_COLUMN_DROP_NOT_NULL = "app_alter_column_drop_not_null"
|
||||
@@ -81,6 +81,10 @@ class BaseBackwardCompatibilityDetection(object):
|
||||
app = fixtures.ALTER_COLUMN
|
||||
self._test_linter_finds_errors(app)
|
||||
|
||||
def test_accept_alter_column_drop_not_null(self):
|
||||
app = fixtures.ALTER_COLUMN_DROP_NOT_NULL
|
||||
self._test_linter_finds_no_errors(app)
|
||||
|
||||
def test_with_git_ref(self):
|
||||
self._test_linter_finds_errors(commit_id="v0.1.4")
|
||||
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AppAddNotNullColumnConfig(AppConfig):
|
||||
name = "app_alter_column_drop_not_null"
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 20:59
|
||||
|
||||
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",
|
||||
),
|
||||
),
|
||||
("not_null_field", models.IntegerField(null=False)),
|
||||
],
|
||||
)
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
# Generated by Django 2.1.4 on 2019-03-19 21:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [("app_alter_column_drop_not_null", "0001_create_table")]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='a',
|
||||
name='not_null_field',
|
||||
field=models.IntegerField(null=True),
|
||||
),
|
||||
]
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class A(models.Model):
|
||||
not_null_field = models.IntegerField(null=True)
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -43,6 +43,7 @@ INSTALLED_APPS = [
|
||||
"tests.test_project.app_add_not_null_column",
|
||||
"tests.test_project.app_add_not_null_column_followed_by_default",
|
||||
"tests.test_project.app_alter_column",
|
||||
"tests.test_project.app_alter_column_drop_not_null",
|
||||
"tests.test_project.app_correct",
|
||||
"tests.test_project.app_create_table_with_not_null_column",
|
||||
"tests.test_project.app_drop_column",
|
||||
|
||||
Reference in new issue
Block a user