First pass implementation of an SQLite backing store for fetched opportunities

This commit is contained in:
bwilliams committed 2026-10-13 12:52:17 +01:00
1 parent 9b0e6dccfe
commit 045492a148
29 files changed
+3132 -9

No files matched your search

@@ -0,0 +1,26 @@
-- +goose Up
-- +goose StatementBegin
-- Shared, write-once lookup of classifications. A row is reused only when
-- every content column matches; any difference (e.g. a changed description)
-- creates a new row.
--
-- When adding a new scheme flag column (e.g. "is_unspsc"), the same migration
-- must drop and recreate "classification_codes_content" with the new column
-- included, otherwise rows differing only by that flag would be merged.
CREATE TABLE IF NOT EXISTS "classification_codes" (
"id" INTEGER PRIMARY KEY,
"is_cpv" BOOLEAN NOT NULL,
"code" TEXT NOT NULL,
"classification" TEXT NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS "classification_codes_content"
ON "classification_codes" ("is_cpv", "code", "classification");
CREATE INDEX IF NOT EXISTS "classification_codes_code"
ON "classification_codes" ("code");
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS "classification_codes";
-- +goose StatementEnd