first with full handle over rpm
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
7948368573
commit
274ea454dd
50 changed files with 4309 additions and 0 deletions
3
internal/store/migrations/000001_init.down.sql
Normal file
3
internal/store/migrations/000001_init.down.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
DROP TABLE IF EXISTS snapshots;
|
||||
DROP TABLE IF EXISTS artifacts;
|
||||
DROP TABLE IF EXISTS repos;
|
||||
25
internal/store/migrations/000001_init.up.sql
Normal file
25
internal/store/migrations/000001_init.up.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
CREATE TABLE IF NOT EXISTS repos (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
type TEXT NOT NULL CHECK(type IN ('apt','rpm','docker','binary')),
|
||||
source_url TEXT NOT NULL,
|
||||
frozen BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS artifacts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
path TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS snapshots (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
||||
label TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
1
internal/store/migrations/000002_clone_jobs.down.sql
Normal file
1
internal/store/migrations/000002_clone_jobs.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE IF EXISTS clone_jobs;
|
||||
11
internal/store/migrations/000002_clone_jobs.up.sql
Normal file
11
internal/store/migrations/000002_clone_jobs.up.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
CREATE TABLE IF NOT EXISTS clone_jobs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
||||
status TEXT NOT NULL CHECK(status IN ('pending','running','completed','failed')) DEFAULT 'pending',
|
||||
started_at DATETIME,
|
||||
finished_at DATETIME,
|
||||
error TEXT,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_clone_jobs_repo_id ON clone_jobs(repo_id);
|
||||
1
internal/store/migrations/000003_sync.down.sql
Normal file
1
internal/store/migrations/000003_sync.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE IF EXISTS pending_packages;
|
||||
18
internal/store/migrations/000003_sync.up.sql
Normal file
18
internal/store/migrations/000003_sync.up.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
ALTER TABLE repos ADD COLUMN sync_mode TEXT NOT NULL DEFAULT 'auto'
|
||||
CHECK(sync_mode IN ('auto', 'manual'));
|
||||
|
||||
CREATE TABLE IF NOT EXISTS pending_packages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
arch TEXT NOT NULL,
|
||||
location TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
checksum_type TEXT NOT NULL,
|
||||
size INTEGER NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(repo_id, name, version, arch)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_pending_packages_repo_id ON pending_packages(repo_id);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
DROP INDEX IF EXISTS idx_snapshot_packages_snapshot_id;
|
||||
DROP TABLE IF EXISTS snapshot_packages;
|
||||
14
internal/store/migrations/000004_snapshot_packages.up.sql
Normal file
14
internal/store/migrations/000004_snapshot_packages.up.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
CREATE TABLE IF NOT EXISTS snapshot_packages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
snapshot_id INTEGER NOT NULL REFERENCES snapshots(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
arch TEXT NOT NULL,
|
||||
location TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
checksum_type TEXT NOT NULL,
|
||||
size INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_snapshot_packages_snapshot_id
|
||||
ON snapshot_packages(snapshot_id);
|
||||
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE IF EXISTS blocked_packages;
|
||||
7
internal/store/migrations/000005_blocked_packages.up.sql
Normal file
7
internal/store/migrations/000005_blocked_packages.up.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS blocked_packages (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
||||
location TEXT NOT NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(repo_id, location)
|
||||
);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
-- SQLite ne supporte pas DROP COLUMN avant 3.35 ; recréation de la table sans la colonne name
|
||||
CREATE TABLE blocked_packages_backup AS SELECT id, repo_id, location, created_at FROM blocked_packages;
|
||||
DROP TABLE blocked_packages;
|
||||
ALTER TABLE blocked_packages_backup RENAME TO blocked_packages;
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE blocked_packages ADD COLUMN name TEXT NOT NULL DEFAULT '';
|
||||
Loading…
Add table
Add a link
Reference in a new issue