mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Improved migration, still fails if email duplicates exist in current DB
This commit is contained in:
parent
ac82640c6c
commit
70a3b7f891
@ -16,12 +16,21 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
# Allow email field to be NULL
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='company',
|
||||||
|
name='email',
|
||||||
|
field=models.EmailField(blank=True, help_text='Contact email address', max_length=254, null=True, unique=False, verbose_name='Email'),
|
||||||
|
),
|
||||||
|
# Convert empty email string to NULL
|
||||||
migrations.RunPython(make_empty_email_field_null),
|
migrations.RunPython(make_empty_email_field_null),
|
||||||
|
# Make email field unique
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='company',
|
model_name='company',
|
||||||
name='email',
|
name='email',
|
||||||
field=models.EmailField(blank=True, help_text='Contact email address', max_length=254, null=True, unique=True, verbose_name='Email'),
|
field=models.EmailField(blank=True, help_text='Contact email address', max_length=254, null=True, unique=True, verbose_name='Email'),
|
||||||
),
|
),
|
||||||
|
# Remove unique constraint on name field
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='company',
|
model_name='company',
|
||||||
name='name',
|
name='name',
|
||||||
|
Loading…
Reference in New Issue
Block a user