73 lines
2.8 KiB
Python
73 lines
2.8 KiB
Python
"""empty message
|
|
|
|
Revision ID: aeab4aff199b
|
|
Revises:
|
|
Create Date: 2020-05-27 15:23:20.611265
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'aeab4aff199b'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('user',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column('username', sa.String(length=64), nullable=True),
|
|
sa.Column('email', sa.String(length=120), nullable=True),
|
|
sa.Column('profile_pic', sa.String(length=256), nullable=True),
|
|
sa.Column('password_hash', sa.String(length=128), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
|
|
op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
|
|
op.create_table('calendar',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('calendar_id', sa.String(length=256), nullable=False),
|
|
sa.Column('name', sa.String(length=256), nullable=True),
|
|
sa.Column('toggle', sa.String(length=8), nullable=True),
|
|
sa.Column('color', sa.String(length=16), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id', 'calendar_id')
|
|
)
|
|
op.create_index(op.f('ix_calendar_name'), 'calendar', ['name'], unique=False)
|
|
op.create_index(op.f('ix_calendar_user_id'), 'calendar', ['user_id'], unique=False)
|
|
op.create_table('device',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
|
sa.Column('deviceName', sa.String(length=64), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('deviceName')
|
|
)
|
|
op.create_table('google_token',
|
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
|
sa.Column('token', sa.String(length=256), nullable=True),
|
|
sa.Column('refresh_token', sa.String(length=256), nullable=True),
|
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('google_token')
|
|
op.drop_table('device')
|
|
op.drop_index(op.f('ix_calendar_user_id'), table_name='calendar')
|
|
op.drop_index(op.f('ix_calendar_name'), table_name='calendar')
|
|
op.drop_table('calendar')
|
|
op.drop_index(op.f('ix_user_username'), table_name='user')
|
|
op.drop_index(op.f('ix_user_email'), table_name='user')
|
|
op.drop_table('user')
|
|
# ### end Alembic commands ###
|