mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 19:33:41 +00:00
- Initialize Alembic with MySQL/MariaDB-targeted configuration - Configure env.py to read DB URL from app.config.get_settings() - Create initial migration (062ccae5457b) for all 11 tables: users, refresh_tokens, invitation_links, allowed_domains, cases, case_icd_codes, weekly_reports, yearly_summary, import_log, audit_log, notifications - Include all indexes, foreign keys, check constraints, and MySQL text prefix index (icd(20)) - Add seed script (scripts/init_db.py) for dak.de domain whitelist - DB apply deferred: MariaDB on Hetzner 1 not reachable from dev Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
684 B
Python
27 lines
684 B
Python
"""Seed initial data into the database."""
|
|
|
|
import sys
|
|
import os
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from app.database import SessionLocal
|
|
from app.models.user import AllowedDomain
|
|
|
|
|
|
def seed() -> None:
|
|
db = SessionLocal()
|
|
try:
|
|
existing = db.query(AllowedDomain).filter_by(domain="dak.de").first()
|
|
if not existing:
|
|
db.add(AllowedDomain(domain="dak.de", role="dak_mitarbeiter"))
|
|
db.commit()
|
|
print("Seeded: dak.de domain whitelist")
|
|
else:
|
|
print("Already exists: dak.de domain whitelist")
|
|
finally:
|
|
db.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
seed()
|