ai_v/migrations/versions/9024b393e1ef_add_some_columns.py

60 lines
2.4 KiB
Python
Raw Permalink Normal View History

"""add some columns
Revision ID: 9024b393e1ef
Revises:
Create Date: 2026-01-16 20:58:52.178001
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9024b393e1ef'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('ai_models')
op.drop_table('aspect_ratios')
op.drop_table('prompt_templates')
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.add_column(sa.Column('has_used_points', sa.Boolean(), nullable=True))
batch_op.drop_column('role')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('users', schema=None) as batch_op:
batch_op.add_column(sa.Column('role', sa.VARCHAR(length=20), server_default=sa.text("'user'::character varying"), autoincrement=False, nullable=True))
batch_op.drop_column('has_used_points')
op.create_table('prompt_templates',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('label', sa.VARCHAR(length=100), autoincrement=False, nullable=False),
sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column('is_active', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('prompt_templates_pkey'))
)
op.create_table('aspect_ratios',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('label', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
sa.Column('value', sa.VARCHAR(length=20), autoincrement=False, nullable=False),
sa.Column('is_active', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('aspect_ratios_pkey'))
)
op.create_table('ai_models',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('name', sa.VARCHAR(length=100), autoincrement=False, nullable=False),
sa.Column('value', sa.VARCHAR(length=100), autoincrement=False, nullable=False),
sa.Column('is_active', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('ai_models_pkey')),
sa.UniqueConstraint('value', name=op.f('ai_models_value_key'), postgresql_include=[], postgresql_nulls_not_distinct=False)
)
# ### end Alembic commands ###