"""add role id Revision ID: c818e5b84075 Revises: 426e52aa13aa Create Date: 2024-10-03 09:35:53.882054 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision: str = 'c818e5b84075' down_revision: Union[str, None] = '426e52aa13aa' 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.drop_table('_prisma_migrations') op.alter_column('category', 'category', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=True) op.alter_column('feedback', 'comment', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=1000), existing_nullable=True) op.alter_column('message', 'goal', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=True) op.alter_column('metadata', 'title', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=True) op.alter_column('metadata', 'author', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=True) op.alter_column('role', 'role_name', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=False) op.alter_column('role', 'description', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), type_=sa.String(length=200), existing_nullable=True) op.add_column('user', sa.Column('role_id', sa.Integer(), nullable=True)) op.alter_column('user', 'name', existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=50), type_=sa.String(length=100), existing_nullable=False) op.create_foreign_key(None, 'user', 'role', ['role_id'], ['id']) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'user', type_='foreignkey') op.alter_column('user', 'name', existing_type=sa.String(length=100), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=50), existing_nullable=False) op.drop_column('user', 'role_id') op.alter_column('role', 'description', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.alter_column('role', 'role_name', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=False) op.alter_column('metadata', 'author', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.alter_column('metadata', 'title', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.alter_column('message', 'goal', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.alter_column('feedback', 'comment', existing_type=sa.String(length=1000), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.alter_column('category', 'category', existing_type=sa.String(length=200), type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=100), existing_nullable=True) op.create_table('_prisma_migrations', sa.Column('id', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=36), nullable=False), sa.Column('checksum', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=64), nullable=False), sa.Column('finished_at', mysql.DATETIME(fsp=3), nullable=True), sa.Column('migration_name', mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=255), nullable=False), sa.Column('logs', mysql.TEXT(collation='utf8mb4_unicode_ci'), nullable=True), sa.Column('rolled_back_at', mysql.DATETIME(fsp=3), nullable=True), sa.Column('started_at', mysql.DATETIME(fsp=3), server_default=sa.text('CURRENT_TIMESTAMP(3)'), nullable=False), sa.Column('applied_steps_count', mysql.INTEGER(unsigned=True), server_default=sa.text("'0'"), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ###