rifalto/migrations/versions/78f324ae4f45_add_timestamps.py

39 lines
1.1 KiB
Python

"""add timestamps
Revision ID: 78f324ae4f45
Revises: 45281a94fd78
Create Date: 2023-06-14 17:54:40.318023
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '78f324ae4f45'
down_revision = '45281a94fd78'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('purchases', schema=None) as batch_op:
batch_op.add_column(sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True))
with op.batch_alter_table('tickets', schema=None) as batch_op:
batch_op.add_column(sa.Column('timestamp', sa.DateTime(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tickets', schema=None) as batch_op:
batch_op.drop_column('timestamp')
with op.batch_alter_table('purchases', schema=None) as batch_op:
batch_op.drop_column('timestamp')
# ### end Alembic commands ###