From 61672f47ac9f027be95b968378596048e03d1c4e Mon Sep 17 00:00:00 2001 From: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:23:40 +0530 Subject: [PATCH] fix: migration files (#2169) --- ..._alter_analyticview_created_by_and_more.py | 21 ++++++++++++++++ .../db/migrations/0043_auto_20230912_1733.py | 24 ------------------- ..._alter_analyticview_created_by_and_more.py | 19 --------------- ...911_1655.py => 0044_auto_20230913_0709.py} | 5 ++-- 4 files changed, 24 insertions(+), 45 deletions(-) delete mode 100644 apiserver/plane/db/migrations/0043_auto_20230912_1733.py delete mode 100644 apiserver/plane/db/migrations/0043_issue_is_draft_alter_analyticview_created_by_and_more.py rename apiserver/plane/db/migrations/{0043_auto_20230911_1655.py => 0044_auto_20230913_0709.py} (98%) diff --git a/apiserver/plane/db/migrations/0043_alter_analyticview_created_by_and_more.py b/apiserver/plane/db/migrations/0043_alter_analyticview_created_by_and_more.py index 6991f4d99..950189c55 100644 --- a/apiserver/plane/db/migrations/0043_alter_analyticview_created_by_and_more.py +++ b/apiserver/plane/db/migrations/0043_alter_analyticview_created_by_and_more.py @@ -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), ] diff --git a/apiserver/plane/db/migrations/0043_auto_20230912_1733.py b/apiserver/plane/db/migrations/0043_auto_20230912_1733.py deleted file mode 100644 index e0602dc93..000000000 --- a/apiserver/plane/db/migrations/0043_auto_20230912_1733.py +++ /dev/null @@ -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), - ] diff --git a/apiserver/plane/db/migrations/0043_issue_is_draft_alter_analyticview_created_by_and_more.py b/apiserver/plane/db/migrations/0043_issue_is_draft_alter_analyticview_created_by_and_more.py deleted file mode 100644 index 7589f3d95..000000000 --- a/apiserver/plane/db/migrations/0043_issue_is_draft_alter_analyticview_created_by_and_more.py +++ /dev/null @@ -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), - ), - ] diff --git a/apiserver/plane/db/migrations/0043_auto_20230911_1655.py b/apiserver/plane/db/migrations/0044_auto_20230913_0709.py similarity index 98% rename from apiserver/plane/db/migrations/0043_auto_20230911_1655.py rename to apiserver/plane/db/migrations/0044_auto_20230913_0709.py index 027e60cbf..f30062371 100644 --- a/apiserver/plane/db/migrations/0043_auto_20230911_1655.py +++ b/apiserver/plane/db/migrations/0044_auto_20230913_0709.py @@ -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 = [