添加migration到git
This commit is contained in:
30
migrations/versions/4f4a8c914911_add_hot_score.py
Normal file
30
migrations/versions/4f4a8c914911_add_hot_score.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""add hot score
|
||||
|
||||
Revision ID: 4f4a8c914911
|
||||
Revises:
|
||||
Create Date: 2021-12-18 03:37:13.716502
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4f4a8c914911'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('post', sa.Column('hot_score', sa.Integer(), server_default='0', nullable=False))
|
||||
op.create_index(op.f('ix_post_comment_timestamp'), 'post', ['comment_timestamp'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_post_comment_timestamp'), table_name='post')
|
||||
op.drop_column('post', 'hot_score')
|
||||
# ### end Alembic commands ###
|
||||
30
migrations/versions/91e5c7d37d43_add_author_title.py
Normal file
30
migrations/versions/91e5c7d37d43_add_author_title.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""add author_title
|
||||
|
||||
Revision ID: 91e5c7d37d43
|
||||
Revises: 4f4a8c914911
|
||||
Create Date: 2021-12-23 17:31:49.909672
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '91e5c7d37d43'
|
||||
down_revision = '4f4a8c914911'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('comment', sa.Column('author_title', sa.String(length=10), nullable=True))
|
||||
op.add_column('post', sa.Column('author_title', sa.String(length=10), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('post', 'author_title')
|
||||
op.drop_column('comment', 'author_title')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user