diff --git a/db/alembic/versions/ea8185bd24c7_unique_const_for_addr.py b/db/alembic/versions/ea8185bd24c7_unique_const_for_addr.py new file mode 100644 index 00000000..40a7c9bc --- /dev/null +++ b/db/alembic/versions/ea8185bd24c7_unique_const_for_addr.py @@ -0,0 +1,32 @@ +"""Unique const for addr + +Revision ID: ea8185bd24c7 +Revises: 40871a7807f6 +Create Date: 2021-08-18 09:41:00.512462 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'ea8185bd24c7' +down_revision = '40871a7807f6' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index('ix_ethereum_addresses_address', table_name='ethereum_addresses') + op.create_index(op.f('ix_ethereum_addresses_address'), 'ethereum_addresses', ['address'], unique=True) + op.create_unique_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', ['id']) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', type_='unique') + op.drop_index(op.f('ix_ethereum_addresses_address'), table_name='ethereum_addresses') + op.create_index('ix_ethereum_addresses_address', 'ethereum_addresses', ['address'], unique=False) + # ### end Alembic commands ### diff --git a/db/moonstreamdb/models.py b/db/moonstreamdb/models.py index 4ed85bf7..3114133f 100644 --- a/db/moonstreamdb/models.py +++ b/db/moonstreamdb/models.py @@ -113,7 +113,7 @@ class EthereumAddress(Base): # type: ignore nullable=True, index=True, ) - address = Column(VARCHAR(256), nullable=False, index=True) + address = Column(VARCHAR(256), nullable=False, unique=True, index=True) created_at = Column( DateTime(timezone=True), server_default=utcnow(), nullable=False ) diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js index ec895ffd..44ad346c 100644 --- a/frontend/pages/_app.js +++ b/frontend/pages/_app.js @@ -39,7 +39,6 @@ export default function CachingApp({ Component, pageProps }) { router.events.on("routeChangeComplete", handleStop); router.events.on("routeChangeError", handleStop); - console.log("_app", router.asPath); return () => { router.events.off("routeChangeStart", handleStart); router.events.off("routeChangeComplete", handleStop); @@ -49,8 +48,6 @@ export default function CachingApp({ Component, pageProps }) { const getLayout = Component.getLayout || ((page) => {page}); - console.log("_app loaded", router.asPath); - return ( <>