kopia lustrzana https://github.com/bugout-dev/moonstream
Add migration.
rodzic
2caaa82953
commit
8506995513
|
@ -0,0 +1,39 @@
|
|||
"""zksync address label_data name index
|
||||
|
||||
Revision ID: 6f7c8d64d49a
|
||||
Revises: a1d9fab5f904
|
||||
Create Date: 2024-04-29 15:26:43.880238
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "6f7c8d64d49a"
|
||||
down_revision = "a1d9fab5f904"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index(
|
||||
"ix_zksync_era_labels_address_label_data_name",
|
||||
"zksync_era_labels",
|
||||
["address", sa.text("(label_data ->> 'name')")],
|
||||
unique=False,
|
||||
postgresql_using="btree",
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
"ix_zksync_era_labels_address_label_data_name",
|
||||
table_name="zksync_era_labels",
|
||||
postgresql_using="btree",
|
||||
)
|
||||
# ### end Alembic commands ###
|
|
@ -15,7 +15,7 @@ from sqlalchemy import (
|
|||
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||
from sqlalchemy.ext.compiler import compiles
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.sql import expression
|
||||
from sqlalchemy.sql import expression, text
|
||||
|
||||
"""
|
||||
Naming conventions doc
|
||||
|
@ -759,6 +759,12 @@ class ZkSyncEraLabel(Base): # type: ignore
|
|||
"block_timestamp",
|
||||
unique=False,
|
||||
),
|
||||
Index(
|
||||
"ix_zksync_era_labels_address_label_data_name",
|
||||
"address",
|
||||
text("(label_data ->> 'name')"),
|
||||
postgresql_using="btree",
|
||||
),
|
||||
)
|
||||
|
||||
id = Column(
|
||||
|
|
Ładowanie…
Reference in New Issue