summaryrefslogtreecommitdiff
path: root/migrations/versions/c2ca1cc5b130_add_author_to_comment.py
blob: f1360b510911a632af9be1b67ebe7163bc8d58f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 ###