This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2023-01-05 12:19:26 +00:00
|
|
|
# flake8: noqa
|
|
|
|
from lifecycle.migrate import BaseMigration
|
|
|
|
|
2023-10-06 16:56:10 +00:00
|
|
|
SQL_STATEMENT = """DROP TABLE "authentik_policies_hibp_haveibeenpwendpolicy";
|
|
|
|
DELETE FROM django_migrations WHERE app = 'authentik_policies_hibp';"""
|
2023-01-05 12:19:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(BaseMigration):
|
|
|
|
def needs_migration(self) -> bool:
|
|
|
|
self.cur.execute(
|
2023-02-01 10:31:32 +00:00
|
|
|
"SELECT * FROM information_schema.tables WHERE table_name ="
|
|
|
|
" 'authentik_policies_hibp_haveibeenpwendpolicy';"
|
2023-01-05 12:19:26 +00:00
|
|
|
)
|
|
|
|
return bool(self.cur.rowcount)
|
|
|
|
|
|
|
|
def run(self):
|
2023-10-06 16:56:10 +00:00
|
|
|
with self.con.transaction():
|
|
|
|
self.cur.execute(SQL_STATEMENT)
|