Skip to content

Instantly share code, notes, and snippets.

@eupharis
Last active October 26, 2022 22:12
Show Gist options
  • Save eupharis/398584dfb5935fede446caa8adec61bd to your computer and use it in GitHub Desktop.
Save eupharis/398584dfb5935fede446caa8adec61bd to your computer and use it in GitHub Desktop.
# ./manage.py shell_plus
# If you only have ONE database
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django.utils import timezone
recorder=MigrationRecorder(connection)
recorder.record_applied(app=app_name, name=migration_name)
# for multiple databases, for some reason, even if you specify the connection it doesn't work
# so just do it in sql
./manage.py dbshell --database=dbname
INSERT into "django_migrations" (app,name,applied) VALUES ($LABEL, $APP_NAME, current_timestamp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment