|
| 1 | +"""init |
| 2 | +
|
| 3 | +Revision ID: f9c634db477d |
| 4 | +Revises: |
| 5 | +Create Date: 2021-09-10 00:24:32.718895 |
| 6 | +
|
| 7 | +""" |
| 8 | +from alembic import op |
| 9 | +import sqlalchemy as sa |
| 10 | +import sqlmodel |
| 11 | + |
| 12 | + |
| 13 | +# revision identifiers, used by Alembic. |
| 14 | +revision = 'f9c634db477d' |
| 15 | +down_revision = None |
| 16 | +branch_labels = None |
| 17 | +depends_on = None |
| 18 | + |
| 19 | + |
| 20 | +def upgrade(): |
| 21 | + # ### commands auto generated by Alembic - please adjust! ### |
| 22 | + op.create_table('song', |
| 23 | + sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False), |
| 24 | + sa.Column('artist', sqlmodel.sql.sqltypes.AutoString(), nullable=False), |
| 25 | + sa.Column('id', sa.Integer(), nullable=True), |
| 26 | + sa.PrimaryKeyConstraint('id') |
| 27 | + ) |
| 28 | + op.create_index(op.f('ix_song_artist'), 'song', ['artist'], unique=False) |
| 29 | + op.create_index(op.f('ix_song_id'), 'song', ['id'], unique=False) |
| 30 | + op.create_index(op.f('ix_song_name'), 'song', ['name'], unique=False) |
| 31 | + # ### end Alembic commands ### |
| 32 | + |
| 33 | + |
| 34 | +def downgrade(): |
| 35 | + # ### commands auto generated by Alembic - please adjust! ### |
| 36 | + op.drop_index(op.f('ix_song_name'), table_name='song') |
| 37 | + op.drop_index(op.f('ix_song_id'), table_name='song') |
| 38 | + op.drop_index(op.f('ix_song_artist'), table_name='song') |
| 39 | + op.drop_table('song') |
| 40 | + # ### end Alembic commands ### |
0 commit comments