servermodel/database/alembic/versions/df08377a186d_initial_migration.py
userName ba8e5ee95a lqs
2024-08-25 04:20:21 +00:00

57 lines
2.3 KiB
Python

"""Initial migration
Revision ID: df08377a186d
Revises:
Create Date: 2024-08-12 09:44:54.105915
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'df08377a186d'
down_revision: Union[str, None] = None
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_index('ix_admin_id', table_name='admin')
op.drop_index('ix_admin_name', table_name='admin')
op.drop_index('ix_admin_username', table_name='admin')
op.drop_table('admin')
op.drop_index('ix_products_id', table_name='products')
op.drop_index('ix_products_name', table_name='products')
op.drop_table('products')
op.drop_index('ix_ir.module.module_state', table_name='ir.module.module')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_index('ix_ir.module.module_state', 'ir.module.module', ['state'], unique=False)
op.create_table('products',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('described', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='products_pkey')
)
op.create_index('ix_products_name', 'products', ['name'], unique=True)
op.create_index('ix_products_id', 'products', ['id'], unique=False)
op.create_table('admin',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('username', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('password', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('is_superuser', sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('id', name='admin_pkey')
)
op.create_index('ix_admin_username', 'admin', ['username'], unique=True)
op.create_index('ix_admin_name', 'admin', ['name'], unique=False)
op.create_index('ix_admin_id', 'admin', ['id'], unique=False)
# ### end Alembic commands ###