kopia lustrzana https://github.com/bugout-dev/moonstream
Added Ethereum Signature Database tables to database
Also cleaned up sample.env, renamed alembic.ini -> alembic.sample.inismart-contract-crawlers
rodzic
11980328dc
commit
77d4cca2a4
|
@ -167,3 +167,5 @@ alembic.dev.ini
|
|||
alembic.prod.ini
|
||||
.db/
|
||||
.venv/
|
||||
.secrets/
|
||||
.moonstreamdb
|
||||
|
|
|
@ -17,7 +17,7 @@ fileConfig(config.config_file_name)
|
|||
# for 'autogenerate' support
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
from db.models import Base as ExplorationBase
|
||||
from moonstreamdb.models import Base as ExplorationBase
|
||||
|
||||
target_metadata = ExplorationBase.metadata
|
||||
|
||||
|
@ -25,7 +25,7 @@ target_metadata = ExplorationBase.metadata
|
|||
# can be acquired:
|
||||
# my_important_option = config.get_main_option("my_important_option")
|
||||
# ... etc.
|
||||
from db.models import EthereumBlock, EthereumTransaction, EthereumPendingTransaction
|
||||
from moonstreamdb.models import EthereumBlock, EthereumTransaction, EthereumPendingTransaction, ESDEventSignature, ESDFunctionSignature
|
||||
|
||||
|
||||
def include_symbol(tablename, schema):
|
||||
|
@ -33,6 +33,8 @@ def include_symbol(tablename, schema):
|
|||
EthereumBlock.__tablename__,
|
||||
EthereumTransaction.__tablename__,
|
||||
EthereumPendingTransaction.__tablename__,
|
||||
ESDEventSignature.__tablename__,
|
||||
ESDFunctionSignature.__tablename__,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
"""Added tables to store data from Ethereum Signature Database
|
||||
|
||||
Revision ID: 1e33c3d07306
|
||||
Revises: aa903a90b8bf
|
||||
Create Date: 2021-07-27 00:04:31.042487
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1e33c3d07306'
|
||||
down_revision = 'aa903a90b8bf'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('esd_event_signatures',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('text_signature', sa.Text(), nullable=False),
|
||||
sa.Column('hex_signature', sa.VARCHAR(length=66), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_esd_event_signatures'))
|
||||
)
|
||||
op.create_table('esd_function_signatures',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('text_signature', sa.Text(), nullable=False),
|
||||
sa.Column('hex_signature', sa.VARCHAR(length=10), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_esd_function_signatures'))
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('esd_function_signatures')
|
||||
op.drop_table('esd_event_signatures')
|
||||
# ### end Alembic commands ###
|
|
@ -129,3 +129,33 @@ class EthereumPendingTransaction(Base): # type: ignore
|
|||
indexed_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class ESDFunctionSignature(Base):
|
||||
"""
|
||||
Function signature from Ethereum Signature Database.
|
||||
"""
|
||||
|
||||
__tablename__ = "esd_function_signatures"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
text_signature = Column(Text, nullable=False)
|
||||
hex_signature = Column(VARCHAR(10), nullable=False)
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
||||
|
||||
class ESDEventSignature(Base):
|
||||
"""
|
||||
Function signature from Ethereum Signature Database.
|
||||
"""
|
||||
|
||||
__tablename__ = "esd_event_signatures"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
text_signature = Column(Text, nullable=False)
|
||||
hex_signature = Column(VARCHAR(66), nullable=False)
|
||||
created_at = Column(
|
||||
DateTime(timezone=True), server_default=utcnow(), nullable=False
|
||||
)
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
export EXPLORATION_DB_URI="<database_uri>"
|
||||
|
||||
export EXPLORATION_DB_URI="postgresql://<username>:<password>@<db_host>:<db_port>/<db_name>"
|
||||
|
|
Ładowanie…
Reference in New Issue