Add (failing) tests cases for makeing a column not null with a Django default value

This commit is contained in:
David Wobrock committed 2020-06-20 18:08:16 +02:00
1 parent d411ea2f6b
commit f21ff2c278
16 files changed
+174

No files matched your search

Whitespace-only changes.
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class AppMakeNotNullWithDjangoDefaultConfig(AppConfig):
name = "app_make_not_null_with_django_default"
@@ -0,0 +1,28 @@
# Generated by Django 2.2 on 2020-06-20 15:17
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",
),
),
("col", models.CharField(max_length=10, null=True)),
],
),
]
@@ -0,0 +1,18 @@
# Generated by Django 2.2 on 2020-06-20 15:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app_make_not_null_with_django_default", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="a",
name="col",
field=models.CharField(default="empty", max_length=10),
),
]
@@ -0,0 +1,5 @@
from django.db import models
class A(models.Model):
col = models.CharField(max_length=10, null=False, default="empty")
Whitespace-only changes.
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class AppMakeNotNullWithLibDefaultConfig(AppConfig):
name = "app_make_not_null_with_lib_default"
@@ -0,0 +1,28 @@
# Generated by Django 2.2 on 2020-06-20 15:23
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",
),
),
("col", models.CharField(max_length=10, null=True)),
],
),
]
@@ -0,0 +1,21 @@
# Generated by Django 2.2 on 2020-06-20 15:23
from django.db import migrations, models
from django_add_default_value import AddDefaultValue
class Migration(migrations.Migration):
dependencies = [
("app_make_not_null_with_lib_default", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="a",
name="col",
field=models.CharField(default="avalue", max_length=10),
),
AddDefaultValue(model_name="a", name="col", value="avalue"),
]
@@ -0,0 +1,5 @@
from django.db import models
class A(models.Model):
col = models.CharField(max_length=10, null=False, default="avalue")
+2
View File
@@ -54,6 +54,8 @@ INSTALLED_APPS = [
"tests.test_project.app_rename_table",
"tests.test_project.app_unique_together",
"tests.test_project.app_data_migrations",
"tests.test_project.app_make_not_null_with_django_default",
"tests.test_project.app_make_not_null_with_lib_default",
]
MIDDLEWARE = [