Skip to content

Commit

Permalink
alembic migration upgrade (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mixx3 authored Sep 24, 2022
1 parent 3e17c02 commit cf3eadc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions migrations/versions/6b75dd50398f_issue2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from alembic import op
import sqlalchemy as sa


revision = '6b75dd50398f'
down_revision = 'f2d45b6daecf'
branch_labels = None
Expand All @@ -11,8 +10,12 @@
def upgrade():
op.add_column('actions_info', sa.Column('additional_data', sa.String(), nullable=True))
op.add_column('user', sa.Column('union_number', sa.String(), nullable=True))
op.add_column('user', sa.Column('modify_ts', sa.DateTime(), nullable=False))
op.add_column('user', sa.Column('create_ts', sa.DateTime(), nullable=False))
op.add_column('user', sa.Column('modify_ts', sa.DateTime(), nullable=True))
op.execute(f'UPDATE "user" SET modify_ts = current_timestamp')
op.alter_column('user', 'modify_ts', nullable=False)
op.add_column('user', sa.Column('create_ts', sa.DateTime(), nullable=True))
op.execute(f'UPDATE "user" SET create_ts = current_timestamp')
op.alter_column('user', 'create_ts', nullable=False)


def downgrade():
Expand Down

0 comments on commit cf3eadc

Please sign in to comment.