Skip to content

Commit

Permalink
add migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
superryeti committed Mar 28, 2023
1 parent 034f961 commit 1b3e9dd
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
134 changes: 134 additions & 0 deletions physionet-django/training/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Generated by Django 3.2.16 on 2023-03-27 20:22

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import project.modelcomponents.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('user', '0055_alter_trainingtype_required_field'),
]

operations = [
migrations.CreateModel(
name='Module',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('order', models.PositiveIntegerField()),
('description', project.modelcomponents.fields.SafeHTMLField()),
],
),
migrations.CreateModel(
name='OnPlatformTraining',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('version', models.FloatField(default=1.0)),
('training_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='op_trainings', to='user.trainingtype')),
],
options={
'default_permissions': ('change',),
'unique_together': {('training_type', 'version')},
},
),
migrations.CreateModel(
name='Quiz',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question', project.modelcomponents.fields.SafeHTMLField()),
('order', models.PositiveIntegerField()),
('module', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='quizzes', to='training.module')),
],
),
migrations.CreateModel(
name='QuizChoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('body', models.TextField()),
('is_correct', models.BooleanField(default=False, verbose_name='Correct Choice?')),
('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='choices', to='training.quiz')),
],
),
migrations.CreateModel(
name='OnPlatformTrainingProgress',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.CharField(choices=[('IP', 'In Progress'), ('C', 'Completed')], default='IP',
max_length=2)),
('started_datetime', models.DateTimeField(auto_now_add=True)),
('completed_datetime', models.DateTimeField(auto_now=True)),
('training', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='training.onplatformtraining')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'unique_together': {('user', 'training')},
},
),
migrations.CreateModel(
name='ModuleProgress',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.CharField(choices=[('IP', 'In Progress'), ('C', 'Completed')], default='IP',
max_length=2)),
('last_completed_order', models.PositiveIntegerField(default=0, null=True)),
('started_datetime', models.DateTimeField(blank=True, null=True)),
('updated_datetime', models.DateTimeField(auto_now=True)),
('module', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='training.module')),
('training_progress', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, related_name='module_progresses',
to='training.onplatformtrainingprogress')),
],
),
migrations.AddField(
model_name='module',
name='training',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='modules',
to='training.onplatformtraining'),
),
migrations.CreateModel(
name='ContentBlock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('body', project.modelcomponents.fields.SafeHTMLField()),
('order', models.PositiveIntegerField()),
('module', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contents',
to='training.module')),
],
),
migrations.CreateModel(
name='CompletedQuiz',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('completed_at', models.DateTimeField(blank=True, null=True)),
('module_progress', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='completed_quizzes', to='training.moduleprogress')),
('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='training.quiz')),
],
),
migrations.CreateModel(
name='CompletedContent',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('completed_at', models.DateTimeField(blank=True, null=True)),
('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='training.contentblock')),
('module_progress', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, related_name='completed_contents',
to='training.moduleprogress')),
],
),
migrations.AlterUniqueTogether(
name='module',
unique_together={('training', 'order')},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.1.5 on 2023-02-18 02:12

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


class Migration(migrations.Migration):

dependencies = [
('user', '0054_alter_credentialapplication_status'),
]

operations = [
migrations.AlterField(
model_name='trainingtype',
name='required_field',
field=models.PositiveSmallIntegerField(
choices=[(0, 'DOCUMENT'), (1, 'URL'), (2, 'PLATFORM')],
default=user.enums.RequiredField['DOCUMENT']),
),
]

0 comments on commit 1b3e9dd

Please sign in to comment.