summaryrefslogtreecommitdiff
path: root/migrations/versions
diff options
context:
space:
mode:
Diffstat (limited to 'migrations/versions')
-rw-r--r--migrations/versions/742bdc6e0718_add_comments.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/migrations/versions/742bdc6e0718_add_comments.py b/migrations/versions/742bdc6e0718_add_comments.py
new file mode 100644
index 0000000..1684b62
--- /dev/null
+++ b/migrations/versions/742bdc6e0718_add_comments.py
@@ -0,0 +1,45 @@
+"""Add comments
+
+Revision ID: 742bdc6e0718
+Revises: 7a92bef47675
+Create Date: 2024-02-02 16:13:58.339249
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '742bdc6e0718'
+down_revision = '7a92bef47675'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('comments',
+ sa.Column('id', sa.BigInteger(), nullable=False),
+ sa.Column('content', sa.Text(), nullable=False),
+ sa.Column('language', sa.String(length=16), nullable=False),
+ sa.Column('email', sa.String(length=256), nullable=False),
+ sa.Column('post', sa.String(length=1024), nullable=False),
+ sa.Column('blog_id', sa.BigInteger(), nullable=False),
+ sa.Column('created_at', sa.DateTime(), nullable=True),
+ sa.Column('updated_at', sa.DateTime(), nullable=True),
+ sa.ForeignKeyConstraint(['blog_id'], ['blogs.id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ with op.batch_alter_table('comments', schema=None) as batch_op:
+ batch_op.create_index(batch_op.f('ix_comments_blog_id'), ['blog_id'], unique=False)
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('comments', schema=None) as batch_op:
+ batch_op.drop_index(batch_op.f('ix_comments_blog_id'))
+
+ op.drop_table('comments')
+ # ### end Alembic commands ###