mirror of
https://github.com/rmontanana/microblog.git
synced 2025-08-16 15:55:51 +00:00
Chapter 6
This commit is contained in:
34
migrations/versions/680d311746e8_new_fields_in_user_model.py
Normal file
34
migrations/versions/680d311746e8_new_fields_in_user_model.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""new fields in user model
|
||||
|
||||
Revision ID: 680d311746e8
|
||||
Revises: d56801750ac8
|
||||
Create Date: 2023-06-03 17:39:48.123676
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '680d311746e8'
|
||||
down_revision = 'd56801750ac8'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('about_me', sa.String(length=140), nullable=True))
|
||||
batch_op.add_column(sa.Column('last_seen', sa.DateTime(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_column('last_seen')
|
||||
batch_op.drop_column('about_me')
|
||||
|
||||
# ### end Alembic commands ###
|
Reference in New Issue
Block a user