admin: store version history (#11520)

Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Marc 'risson' Schmitt
2024-10-17 14:09:44 +02:00
committed by GitHub
parent 0976e05c7d
commit 3262e70eac
7 changed files with 225 additions and 1 deletions

View File

@ -0,0 +1,24 @@
# flake8: noqa
from lifecycle.migrate import BaseMigration
class Migration(BaseMigration):
def needs_migration(self) -> bool:
self.cur.execute(
"SELECT * FROM information_schema.tables WHERE table_name = 'authentik_version_history';"
)
return not bool(self.cur.rowcount)
def run(self):
self.cur.execute(
"""
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS authentik_version_history (
id BIGSERIAL PRIMARY KEY,
"timestamp" timestamp with time zone NOT NULL,
version text NOT NULL,
build text NOT NULL
);
COMMIT;
"""
)