Skip to content

Commit

Permalink
- Update migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Jul 2, 2024
1 parent 0350cdc commit 9d32023
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions apps/lead/migrations/0050_auto_20240621_1149.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ class Migration(migrations.Migration):
old_name='LeadPreviewImage',
new_name='LeadPreviewAttachment'
),

migrations.AddField(
model_name='leadpreviewattachment',
name='file_preview',
field=models.FileField(upload_to='lead-preview/attachments-preview/', null=True)
),
]
14 changes: 7 additions & 7 deletions apps/lead/migrations/0051_auto_20240625_0509.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def set_file_preview(apps, schema_editor):
for lead_attachment in lead_attachments:
lead_attachment.file_preview = lead_attachment.file
lead_attachment.type = 2 # default type is image
lead_attachment.save(updated_fields=['file_preview','type'])
lead_attachment.save()


class Migration(migrations.Migration):
Expand All @@ -29,11 +29,6 @@ class Migration(migrations.Migration):
name='page_number',
field=models.IntegerField(default=0),
),
migrations.AddField(
model_name='leadpreviewattachment',
name='file_preview',
field=models.FileField(upload_to='lead-preview/attachments-preview/')
),
migrations.AddField(
model_name='leadpreviewattachment',
name='type',
Expand All @@ -42,5 +37,10 @@ class Migration(migrations.Migration):
migrations.RunPython(
set_file_preview,
reverse_code=migrations.RunPython.noop,
)
),
migrations.AlterField(
model_name='leadpreviewattachment',
name='file_preview',
field=models.FileField(upload_to='lead-preview/attachments-preview/')
),
]
3 changes: 2 additions & 1 deletion apps/unified_connector/migrations/0010_auto_20240625_0806.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

from django.db import migrations, models


def set_file_preview(apps, schema_editor):
ConnectorLeadPreviewAttachment = apps.get_model('unified_connector', 'ConnectorLeadPreviewAttachment')
connector_lead_attachments = ConnectorLeadPreviewAttachment.objects.all()
for connector_lead_attachment in connector_lead_attachments:
connector_lead_attachment.file_preview = connector_lead_attachment.file
connector_lead_attachment.type = 2 # default type is image
connector_lead_attachment.save(updated_fields=['file_preview','type'])
connector_lead_attachment.save()


class Migration(migrations.Migration):
Expand Down

0 comments on commit 9d32023

Please sign in to comment.