app-MAIL-temp/migrations/versions/2020_041911_dd911f880b75_.py
2020-04-19 11:47:25 +02:00

48 lines
1.6 KiB
Python

"""empty message
Revision ID: dd911f880b75
Revises: 57ef03f3ac34
Create Date: 2020-04-19 11:14:19.929910
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dd911f880b75'
down_revision = '57ef03f3ac34'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('apple_subscription',
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('user_id', sa.Integer(), nullable=False),
sa.Column('expires_date', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('original_transaction_id', sa.String(length=256), nullable=False),
sa.Column('receipt_data', sa.Text(), nullable=False),
sa.Column('plan', sa.Enum('monthly', 'yearly', name='planenum_apple'), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('user_id')
)
op.alter_column('file', 'user_id',
existing_type=sa.INTEGER(),
nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('file', 'user_id',
existing_type=sa.INTEGER(),
nullable=False)
op.drop_table('apple_subscription')
# ### end Alembic commands ###