summaryrefslogtreecommitdiff
path: root/migrations/versions/f5aac764ce5b_create_replies.py
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/versions/f5aac764ce5b_create_replies.py')
-rw-r--r--migrations/versions/f5aac764ce5b_create_replies.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/migrations/versions/f5aac764ce5b_create_replies.py b/migrations/versions/f5aac764ce5b_create_replies.py
new file mode 100644
index 0000000..d8244a6
--- /dev/null
+++ b/migrations/versions/f5aac764ce5b_create_replies.py
@@ -0,0 +1,45 @@
+"""Create replies
+
+Revision ID: f5aac764ce5b
+Revises: 5f6c1515e239
+Create Date: 2024-02-05 12:30:38.848776
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'f5aac764ce5b'
+down_revision = '5f6c1515e239'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('replies',
+ sa.Column('id', sa.BigInteger(), nullable=False),
+ sa.Column('content', sa.Text(), nullable=False),
+ sa.Column('email', sa.String(length=256), nullable=True),
+ sa.Column('author', sa.String(length=128), nullable=True),
+ sa.Column('comment_id', sa.BigInteger(), nullable=False),
+ sa.Column('approved', sa.Boolean(), nullable=False),
+ sa.Column('created_at', sa.DateTime(), nullable=True),
+ sa.Column('updated_at', sa.DateTime(), nullable=True),
+ sa.ForeignKeyConstraint(['comment_id'], ['comments.id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ with op.batch_alter_table('replies', schema=None) as batch_op:
+ batch_op.create_index(batch_op.f('ix_replies_comment_id'), ['comment_id'], unique=False)
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('replies', schema=None) as batch_op:
+ batch_op.drop_index(batch_op.f('ix_replies_comment_id'))
+
+ op.drop_table('replies')
+ # ### end Alembic commands ###