From db6ca79e375c1458d250aee8fe622c2721fcfba7 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Mon, 16 Mar 2026 20:27:00 +0000 Subject: [PATCH] lifecycle/migrate: add flag to skip migrations (#20863) --- authentik/lib/default.yml | 2 ++ lifecycle/migrate.py | 4 +++- .../docs/install-config/configuration/configuration.mdx | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/authentik/lib/default.yml b/authentik/lib/default.yml index cf72a61b28..88e12cee46 100644 --- a/authentik/lib/default.yml +++ b/authentik/lib/default.yml @@ -183,3 +183,5 @@ storage: # backend: file # or s3 # file: {} # s3: {} + +skip_migrations: false diff --git a/lifecycle/migrate.py b/lifecycle/migrate.py index 499bd5d911..9046873dad 100755 --- a/lifecycle/migrate.py +++ b/lifecycle/migrate.py @@ -74,6 +74,8 @@ def release_lock(conn: Connection, cursor: Cursor): def run_migrations(): + if CONFIG.get_bool("skip_migrations", False): + return conn_opts = CONFIG.get_dict_from_b64_json("postgresql.conn_options", default={}) conn = connect( dbname=CONFIG.get("postgresql.name"), @@ -103,7 +105,7 @@ def run_migrations(): if name != "Migration": continue migration = sub(curr, conn) - curr.execute(f"SET search_path = {CONFIG.get("postgresql.default_schema")}") + curr.execute(f"SET search_path = {CONFIG.get('postgresql.default_schema')}") if migration.needs_migration(): LOGGER.info("Migration needs to be applied", migration=migration_path.name) migration.run() diff --git a/website/docs/install-config/configuration/configuration.mdx b/website/docs/install-config/configuration/configuration.mdx index e7faa73d3c..f84ac43d00 100644 --- a/website/docs/install-config/configuration/configuration.mdx +++ b/website/docs/install-config/configuration/configuration.mdx @@ -673,6 +673,14 @@ Defaults to `60s` Defaults to `120s` +## Advanced settings + +##### `AUTHENTIK_SKIP_MIGRATIONS` + +Whether to skip running migrations on starting authentik. This is destined to advanced setups and not recommended in normal use. + +Defaults to `false`. + ## System settings Additional [system settings](../../sys-mgmt/settings.md) are configurable using the Admin interface, under **System** > **Settings** or using the API.