fix: migration files (#2169)

This commit is contained in:
Bavisetti Narayan 2023-09-13 13:23:40 +05:30 committed by GitHub
parent 23e62c83eb
commit 61672f47ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 45 deletions

View File

@ -30,6 +30,16 @@ def create_issue_relation(apps, schema_editor):
capture_exception(e)
def update_issue_priority_choice(apps, schema_editor):
IssueModel = apps.get_model("db", "Issue")
updated_issues = []
for obj in IssueModel.objects.all():
if obj.priority is None:
obj.priority = "none"
updated_issues.append(obj)
IssueModel.objects.bulk_update(updated_issues, ["priority"], batch_size=100)
class Migration(migrations.Migration):
dependencies = [
@ -59,5 +69,16 @@ class Migration(migrations.Migration):
'unique_together': {('issue', 'related_issue')},
},
),
migrations.AddField(
model_name='issue',
name='is_draft',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='issue',
name='priority',
field=models.CharField(choices=[('urgent', 'Urgent'), ('high', 'High'), ('medium', 'Medium'), ('low', 'Low'), ('none', 'None')], default='none', max_length=30, verbose_name='Issue Priority'),
),
migrations.RunPython(create_issue_relation),
migrations.RunPython(update_issue_priority_choice),
]

View File

@ -1,24 +0,0 @@
# Generated by Django 4.2.3 on 2023-09-12 17:33
from django.db import migrations
def update_issue_priority_choice(apps, schema_editor):
IssueModel = apps.get_model("db", "Issue")
updated_issues = []
for obj in IssueModel.objects.all():
if obj.priority is None:
obj.priority = "none"
updated_issues.append(obj)
IssueModel.objects.bulk_update(updated_issues, ["priority"], batch_size=100)
class Migration(migrations.Migration):
dependencies = [
('db', '0042_alter_analyticview_created_by_and_more'),
]
operations = [
migrations.RunPython(update_issue_priority_choice),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.3 on 2023-09-12 12:33
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0042_alter_analyticview_created_by_and_more'),
]
operations = [
migrations.AddField(
model_name='issue',
name='is_draft',
field=models.BooleanField(default=False),
),
]

View File

@ -1,7 +1,8 @@
# Generated by Django 4.2.3 on 2023-09-11 16:55
# Generated by Django 4.2.3 on 2023-09-13 07:09
from django.db import migrations
def workspace_member_props(old_props):
new_props = {
"filters": {
@ -126,7 +127,7 @@ def update_module_props(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
('db', '0042_alter_analyticview_created_by_and_more'),
('db', '0043_alter_analyticview_created_by_and_more'),
]
operations = [