Skip to content

Commit ede3484

Browse files
authored
Merge branch 'main' into main
2 parents c974a44 + 9cdcad4 commit ede3484

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""add year
2+
3+
Revision ID: 53754b2c08a4
4+
Revises: f9c634db477d
5+
Create Date: 2021-09-10 00:52:38.668620
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 = '53754b2c08a4'
15+
down_revision = 'f9c634db477d'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column('song', sa.Column('year', sa.Integer(), nullable=True))
23+
op.create_index(op.f('ix_song_year'), 'song', ['year'], unique=False)
24+
# ### end Alembic commands ###
25+
26+
27+
def downgrade():
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
op.drop_index(op.f('ix_song_year'), table_name='song')
30+
op.drop_column('song', 'year')
31+
# ### end Alembic commands ###
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 ###

project/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ alembic==1.11.1
22
asyncpg==0.28.0
33
fastapi==0.100.0
44
sqlmodel==0.0.8
5-
uvicorn==0.22.0
5+
uvicorn==0.22.0

0 commit comments

Comments
 (0)