lifecycle/migrate: add flag to skip migrations (#20863)

This commit is contained in:
Marc 'risson' Schmitt
2026-03-16 20:27:00 +00:00
committed by GitHub
parent b3dda80166
commit db6ca79e37
3 changed files with 13 additions and 1 deletions

View File

@@ -183,3 +183,5 @@ storage:
# backend: file # or s3
# file: {}
# s3: {}
skip_migrations: false

View File

@@ -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()

View File

@@ -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.