forked from sr2/cloud-api
100 lines
3.6 KiB
Python
100 lines
3.6 KiB
Python
"""mapped columns
|
|
|
|
Revision ID: 869d48618a1c
|
|
Revises: 85edbf9a176c
|
|
Create Date: 2026-06-22 11:18:34.592199
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '869d48618a1c'
|
|
down_revision: Union[str, Sequence[str], None] = '85edbf9a176c'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.alter_column('group', 'org_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=False)
|
|
op.alter_column('organisation', 'name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('organisation', 'status',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('organisation', 'root_user_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=False)
|
|
op.drop_constraint(op.f('organisation_name_key'), 'organisation', type_='unique')
|
|
op.alter_column('permission', 'service_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=False)
|
|
op.alter_column('service', 'name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('service', 'api_key',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.drop_constraint(op.f('service_api_key_key'), 'service', type_='unique')
|
|
op.alter_column('user', 'email',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('user', 'first_name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('user', 'last_name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
op.alter_column('user', 'oidc_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.alter_column('user', 'oidc_id',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('user', 'last_name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('user', 'first_name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('user', 'email',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.create_unique_constraint(op.f('service_api_key_key'), 'service', ['api_key'], postgresql_nulls_not_distinct=False)
|
|
op.alter_column('service', 'api_key',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('service', 'name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('permission', 'service_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=True)
|
|
op.create_unique_constraint(op.f('organisation_name_key'), 'organisation', ['name'], postgresql_nulls_not_distinct=False)
|
|
op.alter_column('organisation', 'root_user_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=True)
|
|
op.alter_column('organisation', 'status',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('organisation', 'name',
|
|
existing_type=sa.VARCHAR(),
|
|
nullable=True)
|
|
op.alter_column('group', 'org_id',
|
|
existing_type=sa.INTEGER(),
|
|
nullable=True)
|
|
# ### end Alembic commands ###
|