mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(releases): add more database indexes (#310)
This commit is contained in:
parent
8c720ac23e
commit
62392fd14c
1 changed files with 62 additions and 0 deletions
|
@ -24,6 +24,9 @@ CREATE TABLE indexer
|
||||||
UNIQUE (identifier)
|
UNIQUE (identifier)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX indexer_identifier_index
|
||||||
|
ON indexer (identifier);
|
||||||
|
|
||||||
CREATE TABLE irc_network
|
CREATE TABLE irc_network
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
|
@ -207,6 +210,15 @@ CREATE TABLE "release"
|
||||||
CREATE INDEX release_filter_id_index
|
CREATE INDEX release_filter_id_index
|
||||||
ON "release" (filter_id);
|
ON "release" (filter_id);
|
||||||
|
|
||||||
|
CREATE INDEX release_indexer_index
|
||||||
|
ON "release" (indexer);
|
||||||
|
|
||||||
|
CREATE INDEX release_timestamp_index
|
||||||
|
ON "release" (timestamp DESC);
|
||||||
|
|
||||||
|
CREATE INDEX release_torrent_name_index
|
||||||
|
ON "release" (torrent_name);
|
||||||
|
|
||||||
CREATE TABLE release_action_status
|
CREATE TABLE release_action_status
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
|
@ -221,6 +233,9 @@ CREATE TABLE release_action_status
|
||||||
FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE
|
FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX release_action_status_release_id_index
|
||||||
|
ON release_action_status (release_id);
|
||||||
|
|
||||||
CREATE TABLE notification
|
CREATE TABLE notification
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
|
@ -774,6 +789,22 @@ ALTER TABLE release_dg_tmp
|
||||||
CREATE INDEX release_filter_id_index
|
CREATE INDEX release_filter_id_index
|
||||||
ON "release" (filter_id);
|
ON "release" (filter_id);
|
||||||
`,
|
`,
|
||||||
|
`
|
||||||
|
CREATE INDEX release_action_status_release_id_index
|
||||||
|
ON release_action_status (release_id);
|
||||||
|
|
||||||
|
CREATE INDEX release_indexer_index
|
||||||
|
ON "release" (indexer);
|
||||||
|
|
||||||
|
CREATE INDEX release_timestamp_index
|
||||||
|
ON "release" (timestamp DESC);
|
||||||
|
|
||||||
|
CREATE INDEX release_torrent_name_index
|
||||||
|
ON "release" (torrent_name);
|
||||||
|
|
||||||
|
CREATE INDEX indexer_identifier_index
|
||||||
|
ON indexer (identifier);
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
const postgresSchema = `
|
const postgresSchema = `
|
||||||
|
@ -800,6 +831,9 @@ CREATE TABLE indexer
|
||||||
UNIQUE (identifier)
|
UNIQUE (identifier)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX indexer_identifier_index
|
||||||
|
ON indexer (identifier);
|
||||||
|
|
||||||
CREATE TABLE irc_network
|
CREATE TABLE irc_network
|
||||||
(
|
(
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
|
@ -1000,6 +1034,15 @@ CREATE TABLE "release"
|
||||||
CREATE INDEX release_filter_id_index
|
CREATE INDEX release_filter_id_index
|
||||||
ON release (filter_id);
|
ON release (filter_id);
|
||||||
|
|
||||||
|
CREATE INDEX release_indexer_index
|
||||||
|
ON "release" (indexer);
|
||||||
|
|
||||||
|
CREATE INDEX release_timestamp_index
|
||||||
|
ON "release" (timestamp DESC);
|
||||||
|
|
||||||
|
CREATE INDEX release_torrent_name_index
|
||||||
|
ON "release" (torrent_name);
|
||||||
|
|
||||||
CREATE TABLE release_action_status
|
CREATE TABLE release_action_status
|
||||||
(
|
(
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
|
@ -1014,6 +1057,9 @@ CREATE TABLE release_action_status
|
||||||
FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE
|
FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX release_action_status_release_id_index
|
||||||
|
ON release_action_status (release_id);
|
||||||
|
|
||||||
CREATE TABLE notification
|
CREATE TABLE notification
|
||||||
(
|
(
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
|
@ -1230,4 +1276,20 @@ var postgresMigrations = []string{
|
||||||
FOREIGN KEY (filter_id) REFERENCES FILTER
|
FOREIGN KEY (filter_id) REFERENCES FILTER
|
||||||
ON DELETE SET NULL;
|
ON DELETE SET NULL;
|
||||||
`,
|
`,
|
||||||
|
`
|
||||||
|
CREATE INDEX release_action_status_release_id_index
|
||||||
|
ON release_action_status (release_id);
|
||||||
|
|
||||||
|
CREATE INDEX release_indexer_index
|
||||||
|
ON "release" (indexer);
|
||||||
|
|
||||||
|
CREATE INDEX release_timestamp_index
|
||||||
|
ON "release" (timestamp DESC);
|
||||||
|
|
||||||
|
CREATE INDEX release_torrent_name_index
|
||||||
|
ON "release" (torrent_name);
|
||||||
|
|
||||||
|
CREATE INDEX indexer_identifier_index
|
||||||
|
ON indexer (identifier);
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue