Detect NULL default value as no default value.
This can happen when using `db_default=None` with `null=False` on a Django model field.
This commit is contained in:
1 parent
8c8a0c65ce
commit
28a0686d3b
9 files changed
+90
-2
No files matched your search
Whitespace-only changes.
+30
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 5.0.1 on 2024-02-04 20:07
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
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", models.IntegerField()),
|
||||
],
|
||||
),
|
||||
]
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.0.1 on 2024-02-04 20:07
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import django.db.models.functions.math
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("app_add_not_null_column_with_null_db_default", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="a",
|
||||
name="not_null_field_db_default_null",
|
||||
field=models.IntegerField(db_default=None, default=None, null=False),
|
||||
),
|
||||
]
|
||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.functions import Pi
|
||||
|
||||
|
||||
class A(models.Model):
|
||||
field = models.IntegerField()
|
||||
not_null_field_db_default_null = models.IntegerField(null=False, db_default=None)
|
||||
Reference in new issue
Block a user