diff options
author | HombreLaser <sebastian-440@live.com> | 2024-02-02 17:04:56 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2024-02-02 17:04:56 -0600 |
commit | ac9746d316271f545776388eb945924ff28fe756 (patch) | |
tree | f14cdabff567bd893944a8964d619a3722c2863f /migrations | |
parent | e417fee5c4afdaae46bb08eba9f31faa80c67e84 (diff) |
Add Comment
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/versions/742bdc6e0718_add_comments.py | 45 |
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 ### |