Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/aggregator/migrations/0001_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ CREATE TABLE mirrored_artifacts (
);

------------------------------------------------------------------------------
-- Labels (populated when the labeler integration lands)
-- Labels (populated when the labeller integration lands)
------------------------------------------------------------------------------

-- Append-only label history. Every label received is written here, including
-- negations. Current state is derived from latest cts per (src, uri, val) and
-- projected into label_state below for hot-path lookups.
CREATE TABLE labels (
src TEXT NOT NULL, -- labeler DID
src TEXT NOT NULL, -- labeller DID
uri TEXT NOT NULL, -- AT URI of subject
cid TEXT, -- optional version-specific CID
val TEXT NOT NULL, -- e.g. 'security:yanked', '!takedown'
Expand Down Expand Up @@ -229,8 +229,8 @@ CREATE TABLE label_state (
CREATE INDEX idx_label_state_enforce ON label_state(uri, val, trusted)
WHERE neg = 0 AND trusted = 1;

-- Trusted/known labelers (operator config, edited via deployment).
CREATE TABLE labelers (
-- Trusted/known labellers (operator config, edited via deployment).
CREATE TABLE labellers (
did TEXT PRIMARY KEY,
endpoint TEXT NOT NULL, -- subscribeLabels URL
signing_key TEXT NOT NULL, -- cached #atproto_label key
Expand Down Expand Up @@ -278,9 +278,9 @@ END;
------------------------------------------------------------------------------

-- Cursor state for ingest sources (Jetstream microsecond timestamp,
-- subscribeLabels seq cursors per labeler, etc.).
-- subscribeLabels seq cursors per labeller, etc.).
CREATE TABLE ingest_state (
source TEXT PRIMARY KEY, -- 'jetstream', 'labeler:did:web:labels.example.com', etc.
source TEXT PRIMARY KEY, -- 'jetstream', 'labeller:did:web:labels.example.com', etc.
cursor TEXT NOT NULL,
updated_at TEXT NOT NULL
);
Expand Down
12 changes: 12 additions & 0 deletions apps/aggregator/migrations/0004_rename_labellers_to_labelers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Rename `labellers` -> `labelers` to match the spelling every query in
-- `src/` uses (`labeler-resolver.ts`, `labels-consumer.ts`,
-- `request-policy.ts`, `index.ts`). `0001_init.sql` shipped the table as
-- `labellers` and is immutable once applied, so the correction has to land as
-- a forward migration: databases provisioned by `0001` keep `labellers` and
-- only this migration brings them to `labelers`.
--
-- No indexes, triggers, or views reference the table, so SQLite's
-- `ALTER TABLE ... RENAME TO` is sufficient — there are no explicitly-named
-- objects embedding the old spelling to recreate.

ALTER TABLE labellers RENAME TO labelers;
Loading
Loading