Migration Copy Scripts

This commit is contained in:
st01765
2026-02-06 13:09:14 +11:00
parent b695dd8054
commit 3583731231
12 changed files with 368 additions and 17 deletions
@@ -0,0 +1,29 @@
from setup_django import *
from coord.models import Company as OldModel
from transport.models import Company as NewModel
created = skipped = 0
for old in OldModel.objects.all():
obj, was_created = NewModel.objects.get_or_create(
id=old.id,
defaults={
"name": old.name,
"contact_name": old.contact_name,
"contact_number": old.contact_number,
"contact_mobile": old.contact_mobile,
"contact_email": old.contact_email,
"address": old.address,
"suburb_id": old.suburb_id,
"notes": old.notes,
}
)
if was_created:
created += 1
else:
skipped += 1
print(f"Companies — created: {created}, skipped: {skipped}")
print("Companies:", OldModel.objects.count(), NewModel.objects.count())