TooAngel/democratic-collaboration

View on GitHub
migrations/versions/59424f8c79d6_initial_migration.py

Summary

Maintainability
A
0 mins
Test Coverage
"""Initial migration.

Revision ID: 59424f8c79d6
Revises:
Create Date: 2020-11-09 21:42:21.177336

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy_utils import UUIDType

# revision identifiers, used by Alembic.
revision = '59424f8c79d6'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'repository',
        sa.Column('id', UUIDType(binary=False), nullable=False),
        sa.Column('full_name', sa.String(length=128), nullable=False),
        sa.Column('github_access_token', sqlalchemy_utils.types.encrypted.encrypted_type.EncryptedType(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('full_name'),
        sa.UniqueConstraint('id')
    )
    op.create_table(
        'sessions',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('session_id', sa.String(length=255), nullable=True),
        sa.Column('data', sa.LargeBinary(), nullable=True),
        sa.Column('expiry', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('session_id')
    )
    op.create_table(
        'user',
        sa.Column('id', UUIDType(binary=False), nullable=False),
        sa.Column('github_access_token', sqlalchemy_utils.types.encrypted.encrypted_type.EncryptedType(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('sessions')
    op.drop_table('repository')
    # ### end Alembic commands ###