"""empty message

Revision ID: aef5947a7e1d
Revises: 
Create Date: 2022-05-06 13:09:10.827263

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('git_provider',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('name', sa.String(length=128), nullable=True),
    sa.Column('base_url_template', sa.String(length=1024), nullable=True),
    sa.Column('clone_url_template', sa.String(length=1024), nullable=True),
    sa.Column('browse_url_template', sa.String(length=1024), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('module_provider',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('namespace', sa.String(length=1024), nullable=True),
    sa.Column('module', sa.String(length=1024), nullable=True),
    sa.Column('provider', sa.String(length=1024), nullable=True),
    sa.Column('repo_base_url_template', sa.String(length=1024), nullable=True),
    sa.Column('repo_clone_url_template', sa.String(length=1024), nullable=True),
    sa.Column('repo_browse_url_template', sa.String(length=1024), nullable=True),
    sa.Column('git_tag_format', sa.String(length=1024), nullable=True),
    sa.Column('verified', sa.Boolean(), nullable=True),
    sa.Column('git_provider_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['git_provider_id'], ['git_provider.id'], onupdate='CASCADE', ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('module_version',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('module_provider_id', sa.Integer(), nullable=False),
    sa.Column('version', sa.String(length=1024), nullable=True),
    sa.Column('owner', sa.String(length=1024), nullable=True),
    sa.Column('description', sa.String(length=1024), nullable=True),
    sa.Column('repo_base_url_template', sa.String(length=1024), nullable=True),
    sa.Column('repo_clone_url_template', sa.String(length=1024), nullable=True),
    sa.Column('repo_browse_url_template', sa.String(length=1024), nullable=True),
    sa.Column('published_at', sa.DateTime(), nullable=True),
    sa.Column('readme_content', sa.BLOB().with_variant(sa.LargeBinary(), "postgresql"), nullable=True),
    sa.Column('module_details', sa.BLOB().with_variant(sa.LargeBinary(), "postgresql"), nullable=True),
    sa.Column('variable_template', sa.BLOB().with_variant(sa.LargeBinary(), "postgresql"), nullable=True),
    sa.Column('published', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['module_provider_id'], ['module_provider.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('analytics',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('parent_module_version', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('terraform_version', sa.String(length=1024), nullable=True),
    sa.Column('analytics_token', sa.String(length=1024), nullable=True),
    sa.Column('auth_token', sa.String(length=1024), nullable=True),
    sa.Column('environment', sa.String(length=1024), nullable=True),
    sa.ForeignKeyConstraint(['parent_module_version'], ['module_version.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('submodule',
    sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
    sa.Column('parent_module_version', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=1024), nullable=True),
    sa.Column('path', sa.String(length=1024), nullable=True),
    sa.Column('name', sa.String(length=1024), nullable=True),
    sa.Column('readme_content', sa.BLOB().with_variant(sa.LargeBinary(), "postgresql"), nullable=True),
    sa.Column('module_details', sa.BLOB().with_variant(sa.LargeBinary(), "postgresql"), nullable=True),
    sa.ForeignKeyConstraint(['parent_module_version'], ['module_version.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('submodule')
    op.drop_table('analytics')
    op.drop_table('module_version')
    op.drop_table('module_provider')
    op.drop_table('git_provider')
    # ### end Alembic commands ###
