FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring, source collection, LLM-based change analysis, enrichment, and account security (Turnstile, escalating lockout, email verification).
65 lines
2.0 KiB
Python
65 lines
2.0 KiB
Python
"""create company enrichments table
|
|
|
|
Revision ID: 79e3aa041131
|
|
Revises: 06e7f03cea36
|
|
Create Date: 2026-08-03 18:43:27.311271
|
|
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Sequence
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "79e3aa041131"
|
|
down_revision: str | None = "06e7f03cea36"
|
|
branch_labels: Sequence[str] | str | None = None
|
|
depends_on: Sequence[str] | str | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"company_enrichments",
|
|
sa.Column("company_id", sa.Uuid(), nullable=False),
|
|
sa.Column(
|
|
"status",
|
|
sa.Enum(
|
|
"PENDING",
|
|
"PARTIAL",
|
|
"COMPLETE",
|
|
"FAILED",
|
|
name="enrichmentstatus",
|
|
native_enum=False,
|
|
length=20,
|
|
),
|
|
nullable=False,
|
|
),
|
|
sa.Column("data", sa.JSON(), nullable=False),
|
|
sa.Column("errors", sa.JSON(), nullable=False),
|
|
sa.Column("credits_spent", sa.Integer(), nullable=True),
|
|
sa.Column("fetched_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("id", sa.Uuid(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
|
sa.ForeignKeyConstraint(["company_id"], ["companies.id"], ondelete="CASCADE"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("id"),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_company_enrichments_company_id"),
|
|
"company_enrichments",
|
|
["company_id"],
|
|
unique=True,
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f("ix_company_enrichments_company_id"), table_name="company_enrichments")
|
|
op.drop_table("company_enrichments")
|
|
# ### end Alembic commands ###
|