app/migrations/versions/2020_010120_d29cca963221_.py

39 lines
1.2 KiB
Python

"""empty message
Revision ID: d29cca963221
Revises: 01f808f15b2e
Create Date: 2020-01-01 20:01:51.861329
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd29cca963221'
down_revision = '01f808f15b2e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('lifetime_coupon',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('code', sa.String(length=128), nullable=False),
sa.Column('nb_used', sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('code')
)
op.add_column('users', sa.Column('lifetime', sa.Boolean(), server_default='0', nullable=False))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'lifetime')
op.drop_table('lifetime_coupon')
# ### end Alembic commands ###