kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #115 from bugout-dev/fix-unique-addr-const
Unique const for addr in ethereum_address tablepull/138/head
commit
ccab0750ed
|
@ -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 ###
|
|
@ -113,7 +113,7 @@ class EthereumAddress(Base): # type: ignore
|
||||||
nullable=True,
|
nullable=True,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
address = Column(VARCHAR(256), nullable=False, index=True)
|
address = Column(VARCHAR(256), nullable=False, unique=True, index=True)
|
||||||
created_at = Column(
|
created_at = Column(
|
||||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue