mirror of
https://github.com/testdrivenio/fastapi-sqlmodel-alembic.git
synced 2025-08-14 17:11:09 +08:00
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""init
|
|
|
|
Revision ID: f9c634db477d
|
|
Revises:
|
|
Create Date: 2021-09-10 00:24:32.718895
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'f9c634db477d'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('song',
|
|
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('artist', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('id', sa.Integer(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_song_artist'), 'song', ['artist'], unique=False)
|
|
op.create_index(op.f('ix_song_id'), 'song', ['id'], unique=False)
|
|
op.create_index(op.f('ix_song_name'), 'song', ['name'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_song_name'), table_name='song')
|
|
op.drop_index(op.f('ix_song_id'), table_name='song')
|
|
op.drop_index(op.f('ix_song_artist'), table_name='song')
|
|
op.drop_table('song')
|
|
# ### end Alembic commands ###
|