Skip to content

Commit 7a4ac65

Browse files
committed
feat: Add the migration for the new model.
1 parent a16e4e3 commit 7a4ac65

File tree

1 file changed

+52
-13
lines changed

1 file changed

+52
-13
lines changed

backend/sample_plugin/migrations/0001_initial.py

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,63 @@ class Migration(migrations.Migration):
1616

1717
operations = [
1818
migrations.CreateModel(
19-
name='CourseArchiveStatus',
19+
name="CourseArchiveStatus",
2020
fields=[
21-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22-
('course_id', opaque_keys.edx.django.models.CourseKeyField(db_index=True, help_text='The unique identifier for the course.', max_length=255)),
23-
('is_archived', models.BooleanField(db_index=True, default=False, help_text='Whether the course is archived.')),
24-
('archive_date', models.DateTimeField(blank=True, help_text='The date and time when the course was archived.', null=True)),
25-
('created_at', models.DateTimeField(auto_now_add=True)),
26-
('updated_at', models.DateTimeField(auto_now=True)),
27-
('user', models.ForeignKey(help_text='The user who this archive status is for.', on_delete=django.db.models.deletion.CASCADE, related_name='course_archive_statuses', to=settings.AUTH_USER_MODEL)),
21+
(
22+
"id",
23+
models.BigAutoField(
24+
auto_created=True,
25+
primary_key=True,
26+
serialize=False,
27+
verbose_name="ID",
28+
),
29+
),
30+
(
31+
"course_id",
32+
opaque_keys.edx.django.models.CourseKeyField(
33+
db_index=True,
34+
help_text="The unique identifier for the course.",
35+
max_length=255,
36+
),
37+
),
38+
(
39+
"is_archived",
40+
models.BooleanField(
41+
db_index=True,
42+
default=False,
43+
help_text="Whether the course is archived.",
44+
),
45+
),
46+
(
47+
"archive_date",
48+
models.DateTimeField(
49+
blank=True,
50+
help_text="The date and time when the course was archived.",
51+
null=True,
52+
),
53+
),
54+
("created_at", models.DateTimeField(auto_now_add=True)),
55+
("updated_at", models.DateTimeField(auto_now=True)),
56+
(
57+
"user",
58+
models.ForeignKey(
59+
help_text="The user who this archive status is for.",
60+
on_delete=django.db.models.deletion.CASCADE,
61+
related_name="course_archive_statuses",
62+
to=settings.AUTH_USER_MODEL,
63+
),
64+
),
2865
],
2966
options={
30-
'verbose_name': 'Course Archive Status',
31-
'verbose_name_plural': 'Course Archive Statuses',
32-
'ordering': ['-updated_at'],
67+
"verbose_name": "Course Archive Status",
68+
"verbose_name_plural": "Course Archive Statuses",
69+
"ordering": ["-updated_at"],
3370
},
3471
),
3572
migrations.AddConstraint(
36-
model_name='coursearchivestatus',
37-
constraint=models.UniqueConstraint(fields=('course_id', 'user'), name='unique_user_course_archive_status'),
73+
model_name="coursearchivestatus",
74+
constraint=models.UniqueConstraint(
75+
fields=("course_id", "user"), name="unique_user_course_archive_status"
76+
),
3877
),
3978
]

0 commit comments

Comments
 (0)