"""initial-db-tables

Revision ID: d925cb39480e
Revises:
Create Date: 2022-05-05 11:45:18.781171

"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "d925cb39480e"
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "contact",
        sa.Column(
            "contact_id",
            postgresql.UUID(as_uuid=True),
            server_default=sa.text("gen_random_uuid()"),
            nullable=False,
        ),
        sa.Column("tags", postgresql.ARRAY(sa.String()), nullable=True),
        sa.Column(
            "created_at",
            postgresql.TIMESTAMP(),
            server_default=sa.text("now()"),
            nullable=False,
        ),
        sa.Column(
            "updated_at",
            postgresql.TIMESTAMP(),
            server_default=sa.text("now()"),
            nullable=False,
        ),
        sa.Column("author_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column("endorse_status", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column("connection_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
        sa.Column("connection_protocol", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column(
            "connection_alias", sqlmodel.sql.sqltypes.AutoString(), nullable=True
        ),
        sa.Column("public_did", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
        sa.Column("state", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.PrimaryKeyConstraint("contact_id"),
    )
    op.create_table(
        "endorserequest",
        sa.Column(
            "endorse_request_id",
            postgresql.UUID(as_uuid=True),
            server_default=sa.text("gen_random_uuid()"),
            nullable=False,
        ),
        sa.Column("tags", postgresql.ARRAY(sa.String()), nullable=True),
        sa.Column(
            "created_at",
            postgresql.TIMESTAMP(),
            server_default=sa.text("now()"),
            nullable=False,
        ),
        sa.Column(
            "updated_at",
            postgresql.TIMESTAMP(),
            server_default=sa.text("now()"),
            nullable=False,
        ),
        sa.Column("transaction_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
        sa.Column("connection_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
        sa.Column("endorser_did", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column("author_did", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column(
            "transaction_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False
        ),
        sa.Column("state", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
        sa.Column("ledger_txn", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
        sa.PrimaryKeyConstraint("endorse_request_id"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("endorserequest")
    op.drop_table("contact")
    # ### end Alembic commands ###

sqlmodel.sql.sqltypes.GUID sqlalchemy.text alembic.op.drop_table sqlalchemy.PrimaryKeyConstraint sqlmodel.sql.sqltypes.AutoString sqlalchemy.dialects.postgresql.UUID sqlalchemy.String sqlalchemy.dialects.postgresql.TIMESTAMP
[((3169, 3200), 'alembic.op.drop_table', 'op.drop_table', (['"""endorserequest"""'], {}), "('endorserequest')\n", (3182, 3200), False, 'from alembic import op\n'), ((3205, 3229), 'alembic.op.drop_table', 'op.drop_table', (['"""contact"""'], {}), "('contact')\n", (3218, 3229), False, 'from alembic import op\n'), ((1683, 1720), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""contact_id"""'], {}), "('contact_id')\n", (1706, 1720), True, 'import sqlalchemy as sa\n'), ((2992, 3037), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""endorse_request_id"""'], {}), "('endorse_request_id')\n", (3015, 3037), True, 'import sqlalchemy as sa\n'), ((516, 545), 'sqlalchemy.dialects.postgresql.UUID', 'postgresql.UUID', ([], {'as_uuid': '(True)'}), '(as_uuid=True)\n', (531, 545), False, 'from sqlalchemy.dialects import postgresql\n'), ((773, 795), 'sqlalchemy.dialects.postgresql.TIMESTAMP', 'postgresql.TIMESTAMP', ([], {}), '()\n', (793, 795), False, 'from sqlalchemy.dialects import postgresql\n'), ((938, 960), 'sqlalchemy.dialects.postgresql.TIMESTAMP', 'postgresql.TIMESTAMP', ([], {}), '()\n', (958, 960), False, 'from sqlalchemy.dialects import postgresql\n'), ((1081, 1115), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1113, 1115), False, 'import sqlmodel\n'), ((1170, 1204), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1202, 1204), False, 'import sqlmodel\n'), ((1258, 1286), 'sqlmodel.sql.sqltypes.GUID', 'sqlmodel.sql.sqltypes.GUID', ([], {}), '()\n', (1284, 1286), False, 'import sqlmodel\n'), ((1346, 1380), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1378, 1380), False, 'import sqlmodel\n'), ((1450, 1484), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1482, 1484), False, 'import sqlmodel\n'), ((1543, 1577), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1575, 1577), False, 'import sqlmodel\n'), ((1622, 1656), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (1654, 1656), False, 'import sqlmodel\n'), ((1840, 1869), 'sqlalchemy.dialects.postgresql.UUID', 'postgresql.UUID', ([], {'as_uuid': '(True)'}), '(as_uuid=True)\n', (1855, 1869), False, 'from sqlalchemy.dialects import postgresql\n'), ((2097, 2119), 'sqlalchemy.dialects.postgresql.TIMESTAMP', 'postgresql.TIMESTAMP', ([], {}), '()\n', (2117, 2119), False, 'from sqlalchemy.dialects import postgresql\n'), ((2262, 2284), 'sqlalchemy.dialects.postgresql.TIMESTAMP', 'postgresql.TIMESTAMP', ([], {}), '()\n', (2282, 2284), False, 'from sqlalchemy.dialects import postgresql\n'), ((2406, 2434), 'sqlmodel.sql.sqltypes.GUID', 'sqlmodel.sql.sqltypes.GUID', ([], {}), '()\n', (2432, 2434), False, 'import sqlmodel\n'), ((2488, 2516), 'sqlmodel.sql.sqltypes.GUID', 'sqlmodel.sql.sqltypes.GUID', ([], {}), '()\n', (2514, 2516), False, 'import sqlmodel\n'), ((2569, 2603), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2601, 2603), False, 'import sqlmodel\n'), ((2654, 2688), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2686, 2688), False, 'import sqlmodel\n'), ((2758, 2792), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2790, 2792), False, 'import sqlmodel\n'), ((2847, 2881), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2879, 2881), False, 'import sqlmodel\n'), ((2932, 2966), 'sqlmodel.sql.sqltypes.AutoString', 'sqlmodel.sql.sqltypes.AutoString', ([], {}), '()\n', (2964, 2966), False, 'import sqlmodel\n'), ((574, 602), 'sqlalchemy.text', 'sa.text', (['"""gen_random_uuid()"""'], {}), "('gen_random_uuid()')\n", (581, 602), True, 'import sqlalchemy as sa\n'), ((686, 697), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (695, 697), True, 'import sqlalchemy as sa\n'), ((824, 840), 'sqlalchemy.text', 'sa.text', (['"""now()"""'], {}), "('now()')\n", (831, 840), True, 'import sqlalchemy as sa\n'), ((989, 1005), 'sqlalchemy.text', 'sa.text', (['"""now()"""'], {}), "('now()')\n", (996, 1005), True, 'import sqlalchemy as sa\n'), ((1898, 1926), 'sqlalchemy.text', 'sa.text', (['"""gen_random_uuid()"""'], {}), "('gen_random_uuid()')\n", (1905, 1926), True, 'import sqlalchemy as sa\n'), ((2010, 2021), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (2019, 2021), True, 'import sqlalchemy as sa\n'), ((2148, 2164), 'sqlalchemy.text', 'sa.text', (['"""now()"""'], {}), "('now()')\n", (2155, 2164), True, 'import sqlalchemy as sa\n'), ((2313, 2329), 'sqlalchemy.text', 'sa.text', (['"""now()"""'], {}), "('now()')\n", (2320, 2329), True, 'import sqlalchemy as sa\n')]