batch import csv

This commit is contained in:
debu-2 2026-10-05 04:53:45 +05:30
parent a679775f57
commit dd0ceef665
20 changed files with 1614 additions and 190 deletions

View file

@ -26,6 +26,24 @@ settings = get_settings()
inbound_server = InboundSMTPServer()
async def migrate_mail_group_columns(connection) -> None:
await connection.execute(
text(
"ALTER TABLE mail_groups ADD COLUMN IF NOT EXISTS owner_id UUID "
"REFERENCES users(id)"
)
)
await connection.execute(
text(
"ALTER TABLE mail_groups ADD COLUMN IF NOT EXISTS send_permission "
"VARCHAR(30) DEFAULT 'org_members'"
)
)
await connection.execute(
text("ALTER TABLE mail_groups ADD COLUMN IF NOT EXISTS description TEXT")
)
async def migrate_user_org_columns(connection) -> None:
await connection.execute(
text("ALTER TABLE users ADD COLUMN IF NOT EXISTS org_role VARCHAR(20)")
@ -96,6 +114,7 @@ async def lifespan(_: FastAPI):
await migrate_legacy_user_tables(connection)
await connection.run_sync(Base.metadata.create_all)
await migrate_user_org_columns(connection)
await migrate_mail_group_columns(connection)
async with SessionFactory() as session:
await ensure_platform_domain(session)
await session.commit()