mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19:06 +00:00
* Sync authentik users * Migrate user_id from uid to id * Fix auth user id * Fix ci migration test * Fix meeting token creation * Move user id migration to a script * Add user on first login * Fix migration chain * Rename uid column to authentik_uid * Fix broken ws test
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""add user table
|
|
|
|
Revision ID: bbafedfa510c
|
|
Revises: 5d6b9df9b045
|
|
Create Date: 2025-11-19 21:06:30.543262
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "bbafedfa510c"
|
|
down_revision: Union[str, None] = "5d6b9df9b045"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"user",
|
|
sa.Column("id", sa.String(), nullable=False),
|
|
sa.Column("email", sa.String(), nullable=False),
|
|
sa.Column("authentik_uid", sa.String(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
|
|
with op.batch_alter_table("user", schema=None) as batch_op:
|
|
batch_op.create_index("idx_user_authentik_uid", ["authentik_uid"], unique=True)
|
|
batch_op.create_index("idx_user_email", ["email"], unique=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("user")
|