feat(03-01): add pgx/v5, PostgreSQL migrations, rename RunMigrations to RunSQLiteMigrations

- Add github.com/jackc/pgx/v5 v5.9.1 dependency
- Add golang-migrate pgx/v5 driver
- Create migrations/postgres/0001_initial_schema.up.sql with SERIAL PRIMARY KEY
- Create migrations/postgres/0001_initial_schema.down.sql
- Rename RunMigrations to RunSQLiteMigrations in migrate.go
- Add RunPostgresMigrations with pgxmigrate driver and 'pgx5' name
- Update export_test.go to use RunSQLiteMigrations (go vet compliance)
This commit is contained in:
2026-03-24 09:08:53 +01:00
parent b6b7ca44dc
commit 95b64b4d54
6 changed files with 136 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
CREATE TABLE IF NOT EXISTS updates (
image TEXT PRIMARY KEY,
diun_version TEXT NOT NULL DEFAULT '',
hostname TEXT NOT NULL DEFAULT '',
status TEXT NOT NULL DEFAULT '',
provider TEXT NOT NULL DEFAULT '',
hub_link TEXT NOT NULL DEFAULT '',
mime_type TEXT NOT NULL DEFAULT '',
digest TEXT NOT NULL DEFAULT '',
created TEXT NOT NULL DEFAULT '',
platform TEXT NOT NULL DEFAULT '',
ctn_name TEXT NOT NULL DEFAULT '',
ctn_id TEXT NOT NULL DEFAULT '',
ctn_state TEXT NOT NULL DEFAULT '',
ctn_status TEXT NOT NULL DEFAULT '',
received_at TEXT NOT NULL,
acknowledged_at TEXT
);
CREATE TABLE IF NOT EXISTS tags (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE
);
CREATE TABLE IF NOT EXISTS tag_assignments (
image TEXT PRIMARY KEY,
tag_id INTEGER NOT NULL REFERENCES tags(id) ON DELETE CASCADE
);