mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 17:08:30 +01:00
Add sql migration
This commit is contained in:
parent
71d53d16da
commit
11772d35e1
1 changed files with 47 additions and 0 deletions
47
migrations/versions/2020_041911_dd911f880b75_.py
Normal file
47
migrations/versions/2020_041911_dd911f880b75_.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
"""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'), 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 ###
|
Loading…
Reference in a new issue