Change updated_at to crawled_at.

pull/225/head
Andrey Dolgolev 2021-09-02 19:01:57 +03:00
rodzic 6836cdb723
commit 3960133c9e
2 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -23,7 +23,7 @@ def upgrade():
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("query", sa.Text(), nullable=False),
sa.Column(
"updated_at",
"crawled_at",
sa.DateTime(timezone=True),
server_default=sa.text("TIMEZONE('utc', statement_timestamp())"),
nullable=False,
@ -32,7 +32,10 @@ def upgrade():
sa.PrimaryKeyConstraint("id", name=op.f("pk_opensea_crawler_state")),
sa.UniqueConstraint("id", name=op.f("uq_opensea_crawler_state_id")),
)
op.drop_constraint("uq_ethereum_labels_label", "ethereum_labels", type_="unique")
op.execute(
"ALTER TABLE ethereum_labels DROP CONSTRAINT IF EXISTS uq_ethereum_labels_label"
)
op.execute(
f"CREATE INDEX idx_ethereum_labels_opensea_nft_name ON ethereum_labels((label_data->>'name')) where label='opensea_nft';"
)

Wyświetl plik

@ -221,8 +221,11 @@ class OpenSeaCrawlingState(Base): # type: ignore
id = Column(Integer, primary_key=True, unique=True, nullable=False)
query = Column(Text, nullable=False)
updated_at = Column(
DateTime(timezone=True), server_default=utcnow(), nullable=False
crawled_at = Column(
DateTime(timezone=True),
server_default=utcnow(),
onupdate=utcnow(),
nullable=False,
)
total_count = Column(Integer, nullable=False)