mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
63 lines
2 KiB
Python
63 lines
2 KiB
Python
"""add organization configurations
|
|
|
|
Revision ID: 1225ac786848
|
|
Revises: 1da1d650c0e4
|
|
Create Date: 2025-07-12 16:32:04.725072
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "1225ac786848"
|
|
down_revision: Union[str, None] = "1da1d650c0e4"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"organization_configurations",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("organization_id", sa.Integer(), nullable=False),
|
|
sa.Column("key", sa.String(), nullable=False),
|
|
sa.Column("value", sa.JSON(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["organization_id"], ["organizations.id"], ondelete="CASCADE"
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("organization_id", "key", name="_organization_key_uc"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_organization_configurations_id"),
|
|
"organization_configurations",
|
|
["id"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
"ix_organization_configurations_organization_id",
|
|
"organization_configurations",
|
|
["organization_id"],
|
|
unique=False,
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(
|
|
"ix_organization_configurations_organization_id",
|
|
table_name="organization_configurations",
|
|
)
|
|
op.drop_index(
|
|
op.f("ix_organization_configurations_id"),
|
|
table_name="organization_configurations",
|
|
)
|
|
op.drop_table("organization_configurations")
|
|
# ### end Alembic commands ###
|