Cargo workspace with five crates per architecture conventions:
- moments-entities: Source enum, Event, EventQuery, SourceSummary
- moments-core: EventReader / EventWriter ports
- moments-data: PgStore (sqlx postgres adapter) + 0001_init.sql
- moments-api: axum binary; /v1/{healthz,events,sources}
- moments-worker: skeleton; pollers land in step 2
Sources committed-to for ingestion: github, gitea, hg, bugzilla.
Workstation events explicitly retired (not deferred).
Build + clippy clean. sqlx queries use the runtime API for now;
will switch to compile-time-checked macros + .sqlx offline cache
once magrathea has the moments_{ro,rw} roles and database created.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
12 lines
426 B
SQL
12 lines
426 B
SQL
CREATE TABLE events (
|
|
id TEXT PRIMARY KEY,
|
|
source TEXT NOT NULL,
|
|
action TEXT NOT NULL,
|
|
occurred_at TIMESTAMPTZ NOT NULL,
|
|
payload JSONB NOT NULL,
|
|
fetched_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX events_occurred_at_desc ON events (occurred_at DESC);
|
|
CREATE INDEX events_source_occurred_at_desc ON events (source, occurred_at DESC);
|