Feature: Support multiple action status per release (#69)

* feat: move release actions to separate table

* chore: update sqlite driver
This commit is contained in:
Ludvig Lundgren 2022-01-08 15:40:31 +01:00 committed by GitHub
parent 2ea2293745
commit e03eac24ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 284 additions and 91 deletions

View file

@ -143,7 +143,6 @@ CREATE TABLE "release"
(
id INTEGER PRIMARY KEY,
filter_status TEXT,
push_status TEXT,
rejections TEXT [] DEFAULT '{}' NOT NULL,
indexer TEXT,
filter TEXT,
@ -190,6 +189,20 @@ CREATE TABLE "release"
uploader TEXT,
pre_time TEXT
);
CREATE TABLE release_action_status
(
id INTEGER PRIMARY KEY,
status TEXT,
action TEXT NOT NULL,
type TEXT NOT NULL,
rejections TEXT [] DEFAULT '{}' NOT NULL,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
raw TEXT,
log TEXT,
release_id INTEGER NOT NULL,
FOREIGN KEY (release_id) REFERENCES "release"(id)
);
`
var migrations = []string{
@ -247,6 +260,27 @@ var migrations = []string{
pre_time TEXT
);
`,
`
CREATE TABLE release_action_status
(
id INTEGER PRIMARY KEY,
status TEXT,
action TEXT NOT NULL,
type TEXT NOT NULL,
rejections TEXT [] DEFAULT '{}' NOT NULL,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
raw TEXT,
log TEXT,
release_id INTEGER NOT NULL,
FOREIGN KEY (release_id) REFERENCES "release"(id)
);
INSERT INTO "release_action_status" (status, action, type, timestamp, release_id)
SELECT push_status, 'DEFAULT', 'QBITTORRENT', timestamp, id FROM "release";
ALTER TABLE "release"
DROP COLUMN push_status;
`,
}
func Migrate(db *sql.DB) error {