Skip to content

Commit

Permalink
- Refactor migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Jun 27, 2024
1 parent 288cca3 commit 0350cdc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion apps/lead/migrations/0050_auto_20240621_1149.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.25 on 2024-06-21 11:49

from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -10,6 +10,11 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AlterField(
model_name='leadpreviewimage',
name='file',
field=models.FileField(upload_to='lead-preview/attachments/')
),
migrations.RenameModel(
old_name='LeadPreviewImage',
new_name='LeadPreviewAttachment'
Expand Down
3 changes: 2 additions & 1 deletion apps/lead/migrations/0051_auto_20240625_0509.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +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'])


class Migration(migrations.Migration):
Expand Down Expand Up @@ -36,7 +37,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='leadpreviewattachment',
name='type',
field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')],max_length=20)
field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')], default=1)
),
migrations.RunPython(
set_file_preview,
Expand Down
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 @@ -8,6 +8,7 @@ def set_file_preview(apps, schema_editor):
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'])


class Migration(migrations.Migration):
Expand Down Expand Up @@ -35,7 +36,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='connectorleadpreviewattachment',
name='type',
field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')])
field=models.PositiveSmallIntegerField(choices=[(1, 'XLSX'), (2, 'Image')], default=1)
),
migrations.RunPython(
set_file_preview,
Expand Down
Empty file removed server.diff
Empty file.

0 comments on commit 0350cdc

Please sign in to comment.