"""label tabel add
|
|
Revision ID: c437168c1da4
|
Revises: 2f304d60542b
|
Create Date: 2024-12-11 15:01:45.049315
|
|
"""
|
from typing import Sequence, Union
|
|
from alembic import op
|
import sqlalchemy as sa
|
|
|
# revision identifiers, used by Alembic.
|
revision: str = 'c437168c1da4'
|
down_revision: Union[str, None] = '2f304d60542b'
|
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('label',
|
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
sa.Column('name', sa.String(length=128), nullable=False),
|
sa.Column('status', sa.String(length=10), nullable=True),
|
sa.Column('creator', sa.Integer(), nullable=True),
|
sa.Column('label_type', sa.Integer(), nullable=True),
|
sa.PrimaryKeyConstraint('id')
|
)
|
op.create_index(op.f('ix_label_id'), 'label', ['id'], unique=False)
|
op.create_index(op.f('ix_label_name'), 'label', ['name'], unique=True)
|
op.create_table('label_worker',
|
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('label_id', sa.Integer(), nullable=True),
|
sa.Column('object_id', sa.String(length=36), nullable=True),
|
sa.PrimaryKeyConstraint('id'),
|
sa.UniqueConstraint('label_id', 'object_id', name='label_object_id_ix')
|
)
|
op.create_index(op.f('ix_label_worker_id'), 'label_worker', ['id'], unique=False)
|
# ### end Alembic commands ###
|
|
|
def downgrade() -> None:
|
# ### commands auto generated by Alembic - please adjust! ###
|
op.drop_index(op.f('ix_label_worker_id'), table_name='label_worker')
|
op.drop_table('label_worker')
|
op.drop_index(op.f('ix_label_name'), table_name='label')
|
op.drop_index(op.f('ix_label_id'), table_name='label')
|
op.drop_table('label')
|
# ### end Alembic commands ###
|