mirror of
https://github.com/goauthentik/authentik
synced 2026-04-27 09:57:31 +02:00
* core: bump black from 25.12.0 to 26.1.0 Bumps [black](https://github.com/psf/black) from 25.12.0 to 26.1.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/25.12.0...26.1.0) --- updated-dependencies: - dependency-name: black dependency-version: 26.1.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * lint Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
# flake8: noqa
|
|
from lifecycle.migrate import BaseMigration
|
|
from datetime import datetime
|
|
|
|
from authentik import authentik_version, authentik_build_hash
|
|
|
|
|
|
class Migration(BaseMigration):
|
|
def needs_migration(self) -> bool:
|
|
self.cur.execute(
|
|
"""
|
|
SELECT * FROM authentik_version_history
|
|
WHERE version = %s AND build = %s
|
|
ORDER BY "timestamp" DESC
|
|
LIMIT 1
|
|
""",
|
|
(authentik_version(), authentik_build_hash()),
|
|
)
|
|
return not bool(self.cur.rowcount)
|
|
|
|
def run(self):
|
|
self.cur.execute(
|
|
"""
|
|
INSERT INTO authentik_version_history ("timestamp", version, build)
|
|
VALUES (%s, %s, %s)
|
|
""",
|
|
(datetime.now(), authentik_version(), authentik_build_hash()),
|
|
)
|
|
self.cur.execute("""
|
|
DELETE FROM authentik_version_history WHERE id NOT IN (
|
|
SELECT id FROM authentik_version_history
|
|
ORDER BY "timestamp" DESC
|
|
LIMIT 1000
|
|
)
|
|
""")
|
|
self.con.commit()
|