Skip to content

Commit

Permalink
Move command calls from migrations to update script #3786
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull authored and mauromsl committed Nov 30, 2023
1 parent 18f8457 commit 93dd993
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
1 change: 1 addition & 0 deletions .update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ python3 src/manage.py install_plugins
python3 src/manage.py update_translation_fields
python3 src/manage.py clear_cache
python3 src/manage.py install_cron
python3 src/manage.py populate_history cms.Page comms.NewsItem repository.Repository

echo "REMINDER: don't forget to restart your webserver!"
exit 0
9 changes: 0 additions & 9 deletions src/cms/migrations/0015_historicalpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
from django.core.management import call_command


def populate_history(apps, schema_editor):
call_command('populate_history', 'cms.Page')


class Migration(migrations.Migration):
Expand Down Expand Up @@ -58,8 +53,4 @@ class Migration(migrations.Migration):
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.RunPython(
populate_history,
reverse_code=migrations.RunPython.noop,
)
]
9 changes: 0 additions & 9 deletions src/comms/migrations/0005_historicalnewsitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
import django.db.models.deletion
import django.utils.timezone
import simple_history.models
from django.core.management import call_command


def populate_history(apps, schema_editor):
call_command('populate_history', 'comms.NewsItem')


class Migration(migrations.Migration):
Expand Down Expand Up @@ -52,8 +47,4 @@ class Migration(migrations.Migration):
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.RunPython(
populate_history,
reverse_code=migrations.RunPython.noop,
)
]
9 changes: 0 additions & 9 deletions src/repository/migrations/0037_historicalrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
from django.core.management import call_command


def populate_history(apps, schema_editor):
call_command('populate_history', 'repository.Repository')


class Migration(migrations.Migration):
Expand Down Expand Up @@ -74,8 +69,4 @@ class Migration(migrations.Migration):
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.RunPython(
populate_history,
reverse_code=migrations.RunPython.noop,
)
]

0 comments on commit 93dd993

Please sign in to comment.