Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Squash all the migrations created during the exercise crowdsourcing development

Roland Geider6684252449ff
diff --git a/wger/exercises/migrations/0018_auto_20220219_1336.py b/wger/exercises/migrations/0018_auto_20220219_1336.py
deleted file mode 100644
index 34ea60c7b..000000000
--- a/wger/exercises/migrations/0018_auto_20220219_1336.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated by Django 3.2.10 on 2022-02-19 12:36
-
-from django.db import migrations, models
-import django.utils.timezone
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('exercises', '0017_auto_20220218_2315'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='exercise',
- name='name_original',
- ),
- migrations.RemoveField(
- model_name='historicalexercise',
- name='name_original',
- ),
- migrations.AddField(
- model_name='exercise',
- name='update_date',
- field=models.DateTimeField(auto_now=True, verbose_name='Date'),
- ),
- migrations.AddField(
- model_name='historicalexercise',
- name='update_date',
- field=models.DateTimeField(
- blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Date'
- ),
- preserve_default=False,
- ),
- ]
diff --git a/wger/exercises/migrations/0017_auto_20220218_2315.py b/wger/exercises/migrations/0018_auto_20220815_2006.py
similarity index 82%
rename from wger/exercises/migrations/0017_auto_20220218_2315.py
rename to wger/exercises/migrations/0018_auto_20220815_2006.py
index 84a92382a..b50797cd2 100644
--- a/wger/exercises/migrations/0017_auto_20220218_2315.py
+++ b/wger/exercises/migrations/0018_auto_20220815_2006.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.2.10 on 2022-02-18 22:15
+# Generated by Django 3.2.15 on 2022-08-15 18:06
from django.conf import settings
import django.core.validators
@@ -9,15 +9,44 @@ import simple_history.models
import uuid
+def delete_pending_exercises(apps, schema_editor):
+ """
+ Delete all pending exercises
+
+ Note that we can't access STATUS_PENDING here because we are not using
+ a real model.
+ """
+ Exercise = apps.get_model("exercises", "Exercise")
+ Exercise.objects.filter(status='1').delete()
+
+
class Migration(migrations.Migration):
dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0014_merge_20210818_1735'),
- ('exercises', '0016_exercisealias'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('exercises', '0017_muscle_name_en'),
]
operations = [
+ migrations.RunPython(delete_pending_exercises),
+ migrations.RemoveField(
+ model_name='exercise',
+ name='name_original',
+ ),
+ migrations.RemoveField(
+ model_name='exercise',
+ name='status',
+ ),
+ migrations.RemoveField(
+ model_name='exercisebase',
+ name='status',
+ ),
+ migrations.AddField(
+ model_name='exercise',
+ name='update_date',
+ field=models.DateTimeField(auto_now=True, verbose_name='Date'),
+ ),
migrations.AddField(
model_name='exercisebase',
name='creation_date',
@@ -31,6 +60,26 @@ class Migration(migrations.Migration):
name='update_date',
field=models.DateTimeField(auto_now=True, verbose_name='Date'),
),
+ migrations.AlterField(
+ model_name='exercisebase',
+ name='variations',
+ field=models.ForeignKey(
+ blank=True,
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ to='exercises.variation',
+ verbose_name='Variations'
+ ),
+ ),
+ migrations.AlterField(
+ model_name='exercisecomment',
+ name='exercise',
+ field=models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ to='exercises.exercise',
+ verbose_name='Exercise'
+ ),
+ ),
migrations.CreateModel(
name='HistoricalExerciseComment',
fields=[
@@ -49,7 +98,7 @@ class Migration(migrations.Migration):
)
),
('history_id', models.AutoField(primary_key=True, serialize=False)),
- ('history_date', models.DateTimeField()),
+ ('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
(
'history_type',
@@ -63,7 +112,6 @@ class Migration(migrations.Migration):
models.ForeignKey(
blank=True,
db_constraint=False,
- editable=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name='+',
@@ -83,8 +131,9 @@ class Migration(migrations.Migration):
],
options={
'verbose_name': 'historical exercise comment',
+ 'verbose_name_plural': 'historical exercise comments',
'ordering': ('-history_date', '-history_id'),
- 'get_latest_by': 'history_date',
+ 'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
@@ -108,15 +157,6 @@ class Migration(migrations.Migration):
verbose_name='Author'
)
),
- (
- 'status',
- models.CharField(
- choices=[('1', 'Pending'), ('2', 'Accepted'), ('3', 'Declined')],
- default='1',
- editable=False,
- max_length=2
- )
- ),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
(
'creation_date',
@@ -127,7 +167,7 @@ class Migration(migrations.Migration):
models.DateTimeField(blank=True, editable=False, verbose_name='Date')
),
('history_id', models.AutoField(primary_key=True, serialize=False)),
- ('history_date', models.DateTimeField()),
+ ('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
(
'history_type',
@@ -185,8 +225,9 @@ class Migration(migrations.Migration):
],
options={
'verbose_name': 'historical exercise base',
+ 'verbose_name_plural': 'historical exercise bases',
'ordering': ('-history_date', '-history_id'),
- 'get_latest_by': 'history_date',
+ 'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
@@ -210,15 +251,6 @@ class Migration(migrations.Migration):
verbose_name='Author'
)
),
- (
- 'status',
- models.CharField(
- choices=[('1', 'Pending'), ('2', 'Accepted'), ('3', 'Declined')],
- default='1',
- editable=False,
- max_length=2
- )
- ),
(
'description',
models.TextField(
@@ -228,17 +260,17 @@ class Migration(migrations.Migration):
)
),
('name', models.CharField(max_length=200, verbose_name='Name')),
- (
- 'name_original',
- models.CharField(default='', max_length=200, verbose_name='Name')
- ),
(
'creation_date',
models.DateField(blank=True, editable=False, null=True, verbose_name='Date')
),
+ (
+ 'update_date',
+ models.DateTimeField(blank=True, editable=False, verbose_name='Date')
+ ),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, verbose_name='UUID')),
('history_id', models.AutoField(primary_key=True, serialize=False)),
- ('history_date', models.DateTimeField()),
+ ('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
(
'history_type',
@@ -297,8 +329,9 @@ class Migration(migrations.Migration):
],
options={
'verbose_name': 'historical exercise',
+ 'verbose_name_plural': 'historical exercises',
'ordering': ('-history_date', '-history_id'),
- 'get_latest_by': 'history_date',
+ 'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
@@ -313,7 +346,7 @@ class Migration(migrations.Migration):
),
('alias', models.CharField(max_length=200, verbose_name='Alias for an exercise')),
('history_id', models.AutoField(primary_key=True, serialize=False)),
- ('history_date', models.DateTimeField()),
+ ('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
(
'history_type',
@@ -346,8 +379,9 @@ class Migration(migrations.Migration):
],
options={
'verbose_name': 'historical alias',
+ 'verbose_name_plural': 'historical aliass',
'ordering': ('-history_date', '-history_id'),
- 'get_latest_by': 'history_date',
+ 'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
diff --git a/wger/exercises/migrations/0019_auto_20220302_2130.py b/wger/exercises/migrations/0019_auto_20220302_2130.py
deleted file mode 100644
index e5fbd2110..000000000
--- a/wger/exercises/migrations/0019_auto_20220302_2130.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated by Django 3.2.10 on 2022-03-02 20:30
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- def delete_pending_exercises(apps, schema_editor):
- """
- Delete all pending exercises
-
- Note that we can't access STATUS_PENDING here because we are not using
- a real model.
- """
- Exercise = apps.get_model("exercises", "Exercise")
- Exercise.objects.filter(status='1').delete()
-
- dependencies = [
- ('exercises', '0018_auto_20220219_1336'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='exercisecomment',
- name='exercise',
- field=models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to='exercises.exercise',
- verbose_name='Exercise'
- ),
- ),
- migrations.AlterField(
- model_name='historicalexercisecomment',
- name='exercise',
- field=models.ForeignKey(
- blank=True,
- db_constraint=False,
- null=True,
- on_delete=django.db.models.deletion.DO_NOTHING,
- related_name='+',
- to='exercises.exercise',
- verbose_name='Exercise'
- ),
- ),
- migrations.RunPython(delete_pending_exercises),
- ]
diff --git a/wger/exercises/migrations/0020_auto_20220302_2136.py b/wger/exercises/migrations/0020_auto_20220302_2136.py
deleted file mode 100644
index da990cf52..000000000
--- a/wger/exercises/migrations/0020_auto_20220302_2136.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated by Django 3.2.10 on 2022-03-02 20:36
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('exercises', '0019_auto_20220302_2130'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='exercise',
- name='status',
- ),
- migrations.RemoveField(
- model_name='exercisebase',
- name='status',
- ),
- migrations.RemoveField(
- model_name='historicalexercise',
- name='status',
- ),
- migrations.RemoveField(
- model_name='historicalexercisebase',
- name='status',
- ),
- ]
diff --git a/wger/exercises/migrations/0021_merge_0017_muscle_name_en_0020_auto_20220302_2136.py b/wger/exercises/migrations/0021_merge_0017_muscle_name_en_0020_auto_20220302_2136.py
deleted file mode 100644
index 7b313dc83..000000000
--- a/wger/exercises/migrations/0021_merge_0017_muscle_name_en_0020_auto_20220302_2136.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated by Django 3.2.10 on 2022-05-22 12:20
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('exercises', '0017_muscle_name_en'),
- ('exercises', '0020_auto_20220302_2136'),
- ]
-
- operations = []
diff --git a/wger/exercises/migrations/0022_auto_20220529_0029.py b/wger/exercises/migrations/0022_auto_20220529_0029.py
deleted file mode 100644
index 0faedde2e..000000000
--- a/wger/exercises/migrations/0022_auto_20220529_0029.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Generated by Django 3.2.13 on 2022-05-28 22:29
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('exercises', '0021_merge_0017_muscle_name_en_0020_auto_20220302_2136'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='historicalalias',
- options={
- 'get_latest_by': ('history_date', 'history_id'),
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical alias',
- 'verbose_name_plural': 'historical aliass'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercise',
- options={
- 'get_latest_by': ('history_date', 'history_id'),
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise',
- 'verbose_name_plural': 'historical exercises'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercisebase',
- options={
- 'get_latest_by': ('history_date', 'history_id'),
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise base',
- 'verbose_name_plural': 'historical exercise bases'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercisecomment',
- options={
- 'get_latest_by': ('history_date', 'history_id'),
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise comment',
- 'verbose_name_plural': 'historical exercise comments'
- },
- ),
- migrations.AlterField(
- model_name='historicalalias',
- name='history_date',
- field=models.DateTimeField(db_index=True),
- ),
- migrations.AlterField(
- model_name='historicalexercise',
- name='history_date',
- field=models.DateTimeField(db_index=True),
- ),
- migrations.AlterField(
- model_name='historicalexercisebase',
- name='history_date',
- field=models.DateTimeField(db_index=True),
- ),
- migrations.AlterField(
- model_name='historicalexercisecomment',
- name='history_date',
- field=models.DateTimeField(db_index=True),
- ),
- ]
diff --git a/wger/exercises/migrations/0023_auto_20220623_1725.py b/wger/exercises/migrations/0023_auto_20220623_1725.py
deleted file mode 100644
index a0b357e5a..000000000
--- a/wger/exercises/migrations/0023_auto_20220623_1725.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Generated by Django 3.2.10 on 2022-06-23 15:25
-
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('exercises', '0022_auto_20220529_0029'),
- ]
-
- operations = [
- migrations.AlterModelOptions(
- name='historicalalias',
- options={
- 'get_latest_by': 'history_date',
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical alias'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercise',
- options={
- 'get_latest_by': 'history_date',
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercisebase',
- options={
- 'get_latest_by': 'history_date',
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise base'
- },
- ),
- migrations.AlterModelOptions(
- name='historicalexercisecomment',
- options={
- 'get_latest_by': 'history_date',
- 'ordering': ('-history_date', '-history_id'),
- 'verbose_name': 'historical exercise comment'
- },
- ),
- migrations.AlterField(
- model_name='exercise',
- name='exercise_base',
- field=models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name='exercises',
- to='exercises.exercisebase',
- verbose_name='ExerciseBase'
- ),
- ),
- migrations.AlterField(
- model_name='historicalalias',
- name='history_date',
- field=models.DateTimeField(),
- ),
- migrations.AlterField(
- model_name='historicalexercise',
- name='exercise_base',
- field=models.ForeignKey(
- blank=True,
- db_constraint=False,
- null=True,
- on_delete=django.db.models.deletion.DO_NOTHING,
- related_name='+',
- to='exercises.exercisebase',
- verbose_name='ExerciseBase'
- ),
- ),
- migrations.AlterField(
- model_name='historicalexercise',
- name='history_date',
- field=models.DateTimeField(),
- ),
- migrations.AlterField(
- model_name='historicalexercisebase',
- name='history_date',
- field=models.DateTimeField(),
- ),
- migrations.AlterField(
- model_name='historicalexercisecomment',
- name='history_date',
- field=models.DateTimeField(),
- ),
- ]
diff --git a/wger/manager/migrations/0016_move_to_exercise_base.py b/wger/manager/migrations/0016_move_to_exercise_base.py
index 6acf54596..d759396c0 100644
--- a/wger/manager/migrations/0016_move_to_exercise_base.py
+++ b/wger/manager/migrations/0016_move_to_exercise_base.py
@@ -26,7 +26,7 @@ def migrate_log_to_exercise_base(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
- ('exercises', '0020_auto_20220302_2136'),
+ ('exercises', '0018_auto_20220815_2006'),
('manager', '0015_auto_20211028_1113'),
]
diff --git a/wger/manager/migrations/0017_alter_workoutlog_exercise_base.py b/wger/manager/migrations/0017_alter_workoutlog_exercise_base.py
index 6ff978be0..1608f4070 100644
--- a/wger/manager/migrations/0017_alter_workoutlog_exercise_base.py
+++ b/wger/manager/migrations/0017_alter_workoutlog_exercise_base.py
@@ -7,7 +7,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
- ('exercises', '0022_auto_20220529_0029'),
+ ('exercises', '0018_auto_20220815_2006'),
('manager', '0016_move_to_exercise_base'),
]