From 75b4b04607877271da6b2efa034e8de3f1440e32 Mon Sep 17 00:00:00 2001
From: hunytalk <ahannan@edx.org>
Date: Wed, 20 Nov 2019 22:22:19 +0500
Subject: [PATCH] Add start_date field in schedule model

---
 .../0008_add_new_start_date_field.py          | 20 +++++++++++++++++++
 openedx/core/djangoapps/schedules/models.py   |  8 ++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py

diff --git a/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py b/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py
new file mode 100644
index 00000000000..3169c942bdb
--- /dev/null
+++ b/openedx/core/djangoapps/schedules/migrations/0008_add_new_start_date_field.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.26 on 2019-11-21 18:00
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('schedules', '0007_scheduleconfig_hold_back_ratio'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='schedule',
+            name='start_date',
+            field=models.DateTimeField(blank=True, db_index=True, help_text='Date this schedule went into effect', null=True),
+        ),
+    ]
diff --git a/openedx/core/djangoapps/schedules/models.py b/openedx/core/djangoapps/schedules/models.py
index fe6013f3696..f79f6951e05 100644
--- a/openedx/core/djangoapps/schedules/models.py
+++ b/openedx/core/djangoapps/schedules/models.py
@@ -18,10 +18,18 @@ class Schedule(TimeStampedModel):
         default=True,
         help_text=_('Indicates if this schedule is actively used')
     )
+    # TODO Delete this field during last stage of rolling out field renames
     start = models.DateTimeField(
         db_index=True,
         help_text=_('Date this schedule went into effect')
     )
+    start_date = models.DateTimeField(
+        # TODO remove blank=True and null=True once data migration is complete in column rename release.
+        blank=True,
+        db_index=True,
+        null=True,
+        help_text=_('Date this schedule went into effect')
+    )
     upgrade_deadline = models.DateTimeField(
         blank=True,
         db_index=True,
-- 
GitLab