44 lines
1.3 KiB
Python
Raw Normal View History

2024-07-29 11:43:52 +08:00
"""empty message
Revision ID: d270947beff6
Revises: 5f6e19ecdbaf
Create Date: 2023-04-13 15:28:37.094758
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd270947beff6'
down_revision = '5f6e19ecdbaf'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('doccomments',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('body', sa.Text(), nullable=True),
sa.Column('timestamp', sa.DateTime(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=True),
sa.Column('doc_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('doccomments', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_doccomments_timestamp'), ['timestamp'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('doccomments', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_doccomments_timestamp'))
op.drop_table('doccomments')
# ### end Alembic commands ###