Add temporary ext_id_old for Corporation and CorpContact
This commit is contained in:
parent
283bd36d02
commit
3ae3820fc3
2 changed files with 33 additions and 0 deletions
31
stages/migrations/0019_add_old_ext_id.py
Normal file
31
stages/migrations/0019_add_old_ext_id.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
def migrate_extid(apps, schema_editor):
|
||||
Corporation = apps.get_model("stages", "Corporation")
|
||||
CorpContact = apps.get_model("stages", "CorpContact")
|
||||
Corporation.objects.update(ext_id_old=models.F('ext_id'))
|
||||
CorpContact.objects.update(ext_id_old=models.F('ext_id'))
|
||||
Corporation.objects.update(ext_id=None)
|
||||
CorpContact.objects.update(ext_id=None)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stages', '0018_removed_referent_model'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='corpcontact',
|
||||
name='ext_id_old',
|
||||
field=models.IntegerField(blank=True, null=True, verbose_name='ID externe (ancien)'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='corporation',
|
||||
name='ext_id_old',
|
||||
field=models.IntegerField(blank=True, null=True, verbose_name='ID externe (ancien)'),
|
||||
),
|
||||
migrations.RunPython(migrate_extid, migrations.RunPython.noop),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue