spb/company-atlas
Public
Python 66.3%
TypeScript 22.7%
JavaScript 8.6%
HTML 1.4%
CSS 0.7%
1"""Baseline flags on extracted entities + trigram search indexes.23Entities captured by a sensor's very first snapshot are not "new" — they existed before we started observing (coverage4normalisation, spec §145). `baseline = true` lets metrics, daily aggregates and job summaries count only entities that appeared5*after* observation started, without touching first_seen_at (which stays the honest observation timestamp).67Revision ID: 00028Revises: 00019"""10from __future__ import annotations1112from alembic import op1314revision = "0002"15down_revision = "0001"16branch_labels = None17depends_on = None1819SQL = """20alter table jobs add column if not exists baseline boolean not null default false;21alter table people add column if not exists baseline boolean not null default false;22alter table products add column if not exists baseline boolean not null default false;23alter table locations add column if not exists baseline boolean not null default false;24alter table news_items add column if not exists baseline boolean not null default false;25alter table pricing_plans add column if not exists baseline boolean not null default false;26create index if not exists jobs_new_idx on jobs (company_id, first_seen_at desc) where not baseline;27create index if not exists news_items_new_idx on news_items (company_id, first_seen_at desc) where not baseline;28create index if not exists people_name_trgm_idx on people using gin (name gin_trgm_ops);29create index if not exists products_name_trgm_idx on products using gin (name gin_trgm_ops);30"""313233def upgrade() -> None:34 for stmt in [s.strip() for s in SQL.split(";") if s.strip()]:35 op.execute(stmt)363738def downgrade() -> None:39 raise RuntimeError("forward-only migrations")40