From b3247ff834b428e7d33745ee8587158d6c05f0a3 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 3 Feb 2024 17:25:59 -0600 Subject: Add author to comment --- .../versions/c2ca1cc5b130_add_author_to_comment.py | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 migrations/versions/c2ca1cc5b130_add_author_to_comment.py (limited to 'migrations/versions/c2ca1cc5b130_add_author_to_comment.py') diff --git a/migrations/versions/c2ca1cc5b130_add_author_to_comment.py b/migrations/versions/c2ca1cc5b130_add_author_to_comment.py new file mode 100644 index 0000000..f1360b5 --- /dev/null +++ b/migrations/versions/c2ca1cc5b130_add_author_to_comment.py @@ -0,0 +1,38 @@ +"""Add author to comment + +Revision ID: c2ca1cc5b130 +Revises: 742bdc6e0718 +Create Date: 2024-02-03 16:47:06.111596 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = 'c2ca1cc5b130' +down_revision = '742bdc6e0718' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('comments', schema=None) as batch_op: + batch_op.add_column(sa.Column('author', sa.String(length=128), nullable=True)) + batch_op.alter_column('email', + existing_type=mysql.VARCHAR(length=256), + nullable=True) + + # ### 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.alter_column('email', + existing_type=mysql.VARCHAR(length=256), + nullable=False) + batch_op.drop_column('author') + + # ### end Alembic commands ### -- cgit v1.2.3