From 79cd65a28960218ba75e0c54e724fcf5a45bd27f Mon Sep 17 00:00:00 2001 From: Tim Olson <> Date: Thu, 21 Sep 2023 17:31:20 -0400 Subject: [PATCH] added alembic revision and updated gitignore --- .gitignore | 5 ++-- alembic/versions/1da309899f95_.py | 44 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 alembic/versions/1da309899f95_.py diff --git a/.gitignore b/.gitignore index d785257..8a6ad66 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -venv/ +venv *secret* dexorder.toml -./contract +/contract .idea +__pycache__ diff --git a/alembic/versions/1da309899f95_.py b/alembic/versions/1da309899f95_.py new file mode 100644 index 0000000..82999c4 --- /dev/null +++ b/alembic/versions/1da309899f95_.py @@ -0,0 +1,44 @@ +"""empty message + +Revision ID: 1da309899f95 +Revises: +Create Date: 2023-09-18 19:18:11.706312 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision: str = '1da309899f95' +down_revision: Union[str, None] = None +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('block', + sa.Column('chain', sa.Integer(), nullable=False), + sa.Column('height', sa.Integer(), nullable=False), + sa.Column('hash', sa.LargeBinary(), nullable=False), + sa.Column('parent', sa.LargeBinary(), nullable=False), + sa.Column('data', postgresql.JSONB(astext_type=sa.Text()), nullable=False), + sa.PrimaryKeyConstraint('chain', 'height', 'hash') + ) + op.drop_table('migrations') + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('migrations', + sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), + sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False), + sa.Column('run_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=False), + sa.PrimaryKeyConstraint('id', name='migrations_pkey') + ) + op.drop_table('block') + # ### end Alembic commands ###