Fuehre die Pflicht-Suite gegen eine Wegwerfdatenbank und lege Nutzer als Betreiber an.
Deploy Development / deploy (push) Failing after 40s
Deploy Development / deploy (push) Failing after 40s
Testdaten entstehen nur dort und werden danach entfernt, damit Dev und Produktion sie nicht behalten. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
528fc191e8
commit
4420790707
24 files changed
+1264
-26
No files matched your search
+4
-6
@@ -1,4 +1,4 @@
|
||||
"""Operator commands: migrate, seed demo data, create the first account."""
|
||||
"""Operator commands: migrate and create an account. Demo seed stays in the test suite."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -7,7 +7,6 @@ import argparse
|
||||
from app.auth.accounts import create_account
|
||||
from app.core.settings import get_settings
|
||||
from app.db.migrate import migrate
|
||||
from app.seed import seed_demo
|
||||
|
||||
import psycopg
|
||||
from psycopg.rows import dict_row
|
||||
@@ -29,13 +28,12 @@ def main() -> None:
|
||||
print("applied" if applied else "up to date")
|
||||
return
|
||||
if args.command == "seed-demo":
|
||||
created = seed_demo(settings)
|
||||
print("seeded" if created else "unchanged")
|
||||
return
|
||||
raise SystemExit("Testdaten legt nur die Test-Suite an und entfernt sie wieder.")
|
||||
if len(args.password) < 10:
|
||||
raise SystemExit("password must be at least 10 characters")
|
||||
with psycopg.connect(settings.dsn(), row_factory=dict_row) as conn:
|
||||
account = create_account(conn, args.email, args.name, args.password)
|
||||
has_admin = conn.execute("SELECT 1 FROM auth_accounts WHERE is_superadmin LIMIT 1").fetchone()
|
||||
account = create_account(conn, args.email, args.name, args.password, is_superadmin=has_admin is None)
|
||||
conn.commit()
|
||||
print(account["id"])
|
||||
|
||||
|
||||
Reference in new issue
Block a user