diff options
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/versions/c2ca1cc5b130_add_author_to_comment.py | 38 |
1 files changed, 38 insertions, 0 deletions
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 ### |