添加migration到git

This commit is contained in:
2021-12-24 00:09:03 +08:00
parent e8ef07cceb
commit 54a7c9c69a
7 changed files with 228 additions and 1 deletions

View 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 ###

View 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 ###