65 lines
2.4 KiB
Python
65 lines
2.4 KiB
Python
"""add_terms_accepted
|
|
|
|
Revision ID: 229359b0d1b2
|
|
Revises: 823a486fd287
|
|
Create Date: 2026-04-01 11:28:44.953518
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '229359b0d1b2'
|
|
down_revision: Union[str, None] = '823a486fd287'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('drive_comments', schema=None) as batch_op:
|
|
batch_op.alter_column('rejected_at',
|
|
existing_type=postgresql.TIMESTAMP(timezone=True),
|
|
type_=sa.DateTime(),
|
|
existing_nullable=True)
|
|
|
|
with op.batch_alter_table('drive_stars', schema=None) as batch_op:
|
|
batch_op.alter_column('created_at',
|
|
existing_type=postgresql.TIMESTAMP(timezone=True),
|
|
type_=sa.TIMESTAMP(),
|
|
nullable=True,
|
|
existing_server_default=sa.text('now()'))
|
|
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('terms_accepted', sa.Boolean(), nullable=False, server_default=sa.text('false')))
|
|
batch_op.drop_index(batch_op.f('ix_users_email'))
|
|
batch_op.create_index(batch_op.f('ix_users_email'), ['email'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_users_email'))
|
|
batch_op.create_index(batch_op.f('ix_users_email'), ['email'], unique=True)
|
|
batch_op.drop_column('terms_accepted')
|
|
|
|
with op.batch_alter_table('drive_stars', schema=None) as batch_op:
|
|
batch_op.alter_column('created_at',
|
|
existing_type=sa.TIMESTAMP(),
|
|
type_=postgresql.TIMESTAMP(timezone=True),
|
|
nullable=False,
|
|
existing_server_default=sa.text('now()'))
|
|
|
|
with op.batch_alter_table('drive_comments', schema=None) as batch_op:
|
|
batch_op.alter_column('rejected_at',
|
|
existing_type=sa.DateTime(),
|
|
type_=postgresql.TIMESTAMP(timezone=True),
|
|
existing_nullable=True)
|
|
|
|
# ### end Alembic commands ###
|