From 5a3dbca425685104912cdb2239c778f0af3e7af9 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 18 Nov 2021 11:55:03 -0500 Subject: [PATCH 1/2] Create usd_prices table --- .../d540242ae368_create_usd_prices_table.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 alembic/versions/d540242ae368_create_usd_prices_table.py diff --git a/alembic/versions/d540242ae368_create_usd_prices_table.py b/alembic/versions/d540242ae368_create_usd_prices_table.py new file mode 100644 index 0000000..09c871c --- /dev/null +++ b/alembic/versions/d540242ae368_create_usd_prices_table.py @@ -0,0 +1,30 @@ +"""Create usd_prices table + +Revision ID: d540242ae368 +Revises: 04a3bb3740c3 +Create Date: 2021-11-18 04:30:06.802857 + +""" +import sqlalchemy as sa +from alembic import op + + +# revision identifiers, used by Alembic. +revision = "d540242ae368" +down_revision = "2c90b2b8a80b" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "usd_prices", + sa.Column("timestamp", sa.TIMESTAMP), + sa.Column("usd_price", sa.Numeric, nullable=False), + sa.Column("token_address", sa.String(256), nullable=False), + sa.PrimaryKeyConstraint("token_address", "timestamp"), + ) + + +def downgrade(): + op.drop_table("usd_prices") From 7d50d3d674be4bb8dd62624fd95547ca4c694653 Mon Sep 17 00:00:00 2001 From: Luke Van Seters Date: Thu, 18 Nov 2021 13:55:38 -0500 Subject: [PATCH 2/2] Rename to prices table --- alembic/versions/d540242ae368_create_usd_prices_table.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alembic/versions/d540242ae368_create_usd_prices_table.py b/alembic/versions/d540242ae368_create_usd_prices_table.py index 09c871c..d97a2f9 100644 --- a/alembic/versions/d540242ae368_create_usd_prices_table.py +++ b/alembic/versions/d540242ae368_create_usd_prices_table.py @@ -1,7 +1,7 @@ """Create usd_prices table Revision ID: d540242ae368 -Revises: 04a3bb3740c3 +Revises: 2c90b2b8a80b Create Date: 2021-11-18 04:30:06.802857 """ @@ -18,7 +18,7 @@ depends_on = None def upgrade(): op.create_table( - "usd_prices", + "prices", sa.Column("timestamp", sa.TIMESTAMP), sa.Column("usd_price", sa.Numeric, nullable=False), sa.Column("token_address", sa.String(256), nullable=False), @@ -27,4 +27,4 @@ def upgrade(): def downgrade(): - op.drop_table("usd_prices") + op.drop_table("prices")