admin: store version history (#11520)
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
committed by
GitHub
parent
0976e05c7d
commit
3262e70eac
24
lifecycle/system_migrations/version_history_create.py
Normal file
24
lifecycle/system_migrations/version_history_create.py
Normal 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;
|
||||
"""
|
||||
)
|
||||
Reference in New Issue
Block a user