lifecycle: re-fix system migrations (#7185)
fix system migrations? Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
25d4905d6c
commit
dce913496e
|
@ -2,6 +2,7 @@
|
||||||
from lifecycle.migrate import BaseMigration
|
from lifecycle.migrate import BaseMigration
|
||||||
|
|
||||||
SQL_STATEMENT = """
|
SQL_STATEMENT = """
|
||||||
|
BEGIN TRANSACTION;
|
||||||
DELETE FROM django_migrations WHERE app = 'passbook_stages_prompt';
|
DELETE FROM django_migrations WHERE app = 'passbook_stages_prompt';
|
||||||
DROP TABLE passbook_stages_prompt_prompt cascade;
|
DROP TABLE passbook_stages_prompt_prompt cascade;
|
||||||
DROP TABLE passbook_stages_prompt_promptstage cascade;
|
DROP TABLE passbook_stages_prompt_promptstage cascade;
|
||||||
|
@ -22,6 +23,7 @@ DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0008_defa
|
||||||
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0009_source_flows';
|
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0009_source_flows';
|
||||||
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0010_provider_flows';
|
DELETE FROM django_migrations WHERE app = 'passbook_flows' AND name = '0010_provider_flows';
|
||||||
DELETE FROM django_migrations WHERE app = 'passbook_stages_password' AND name = '0002_passwordstage_change_flow';
|
DELETE FROM django_migrations WHERE app = 'passbook_stages_password' AND name = '0002_passwordstage_change_flow';
|
||||||
|
COMMIT;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from redis import Redis
|
||||||
from authentik.lib.config import CONFIG
|
from authentik.lib.config import CONFIG
|
||||||
from lifecycle.migrate import BaseMigration
|
from lifecycle.migrate import BaseMigration
|
||||||
|
|
||||||
SQL_STATEMENT = """
|
SQL_STATEMENT = """BEGIN TRANSACTION;
|
||||||
ALTER TABLE passbook_audit_event RENAME TO authentik_audit_event;
|
ALTER TABLE passbook_audit_event RENAME TO authentik_audit_event;
|
||||||
ALTER TABLE passbook_core_application RENAME TO authentik_core_application;
|
ALTER TABLE passbook_core_application RENAME TO authentik_core_application;
|
||||||
ALTER TABLE passbook_core_group RENAME TO authentik_core_group;
|
ALTER TABLE passbook_core_group RENAME TO authentik_core_group;
|
||||||
|
@ -92,6 +92,7 @@ ALTER SEQUENCE passbook_stages_prompt_promptstage_validation_policies_id_seq REN
|
||||||
|
|
||||||
UPDATE django_migrations SET app = replace(app, 'passbook', 'authentik');
|
UPDATE django_migrations SET app = replace(app, 'passbook', 'authentik');
|
||||||
UPDATE django_content_type SET app_label = replace(app_label, 'passbook', 'authentik');
|
UPDATE django_content_type SET app_label = replace(app_label, 'passbook', 'authentik');
|
||||||
|
COMMIT;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
from lifecycle.migrate import BaseMigration
|
from lifecycle.migrate import BaseMigration
|
||||||
|
|
||||||
SQL_STATEMENT = """ALTER TABLE authentik_audit_event RENAME TO authentik_events_event;
|
SQL_STATEMENT = """BEGIN TRANSACTION;
|
||||||
|
ALTER TABLE authentik_audit_event RENAME TO authentik_events_event;
|
||||||
UPDATE django_migrations SET app = replace(app, 'authentik_audit', 'authentik_events');
|
UPDATE django_migrations SET app = replace(app, 'authentik_audit', 'authentik_events');
|
||||||
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_audit', 'authentik_events');"""
|
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_audit', 'authentik_events');
|
||||||
|
|
||||||
|
COMMIT;"""
|
||||||
|
|
||||||
|
|
||||||
class Migration(BaseMigration):
|
class Migration(BaseMigration):
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from lifecycle.migrate import BaseMigration
|
from lifecycle.migrate import BaseMigration
|
||||||
|
|
||||||
SQL_STATEMENT = """
|
SQL_STATEMENT = """
|
||||||
|
BEGIN TRANSACTION;
|
||||||
ALTER TABLE authentik_stages_otp_static_otpstaticstage RENAME TO authentik_stages_authenticator_static_otpstaticstage;
|
ALTER TABLE authentik_stages_otp_static_otpstaticstage RENAME TO authentik_stages_authenticator_static_otpstaticstage;
|
||||||
UPDATE django_migrations SET app = replace(app, 'authentik_stages_otp_static', 'authentik_stages_authenticator_static');
|
UPDATE django_migrations SET app = replace(app, 'authentik_stages_otp_static', 'authentik_stages_authenticator_static');
|
||||||
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_stages_otp_static', 'authentik_stages_authenticator_static');
|
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_stages_otp_static', 'authentik_stages_authenticator_static');
|
||||||
|
@ -13,6 +14,7 @@ UPDATE django_content_type SET app_label = replace(app_label, 'authentik_stages_
|
||||||
ALTER TABLE authentik_stages_otp_validate_otpvalidatestage RENAME TO authentik_stages_authenticator_validate_otpvalidatestage;
|
ALTER TABLE authentik_stages_otp_validate_otpvalidatestage RENAME TO authentik_stages_authenticator_validate_otpvalidatestage;
|
||||||
UPDATE django_migrations SET app = replace(app, 'authentik_stages_otp_validate', 'authentik_stages_authenticator_validate');
|
UPDATE django_migrations SET app = replace(app, 'authentik_stages_otp_validate', 'authentik_stages_authenticator_validate');
|
||||||
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_stages_otp_validate', 'authentik_stages_authenticator_validate');
|
UPDATE django_content_type SET app_label = replace(app_label, 'authentik_stages_otp_validate', 'authentik_stages_authenticator_validate');
|
||||||
|
COMMIT;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
from lifecycle.migrate import BaseMigration
|
from lifecycle.migrate import BaseMigration
|
||||||
|
|
||||||
SQL_STATEMENT = """DROP TABLE "authentik_policies_hibp_haveibeenpwendpolicy";
|
SQL_STATEMENT = """
|
||||||
DELETE FROM django_migrations WHERE app = 'authentik_policies_hibp';"""
|
BEGIN TRANSACTION;
|
||||||
|
DROP TABLE "authentik_policies_hibp_haveibeenpwendpolicy";
|
||||||
|
DELETE FROM django_migrations WHERE app = 'authentik_policies_hibp';
|
||||||
|
COMMIT;"""
|
||||||
|
|
||||||
|
|
||||||
class Migration(BaseMigration):
|
class Migration(BaseMigration):
|
||||||
|
|
Reference in New Issue