Add missing indices to schema

This commit is contained in:
2023-10-28 18:49:27 +02:00
parent 503f927bf5
commit b8de278055

View File

@@ -32,8 +32,6 @@ CREATE TABLE item (
); );
-- Add an index for "... WHERE deletion IS NULL" -- Add an index for "... WHERE deletion IS NULL"
CREATE INDEX item_deletion_partial ON item (deleted) WHERE deleted IS NULL; CREATE INDEX item_deletion_partial ON item (deleted) WHERE deleted IS NULL;
-- * nuked: if the item has been removed from storage & user indicated he does not
-- want to count it as potentially in his possession any longer
CREATE TABLE item_extra ( CREATE TABLE item_extra (
item_id INTEGER PRIMARY KEY, item_id INTEGER PRIMARY KEY,
@@ -65,6 +63,7 @@ CREATE TABLE item_extra (
FOREIGN KEY (item_id) REFERENCES item (id) FOREIGN KEY (item_id) REFERENCES item (id)
); );
CREATE INDEX item_extra_item_id ON item_extra (item_id);
CREATE TABLE item_stat ( CREATE TABLE item_stat (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@@ -77,6 +76,7 @@ CREATE TABLE item_stat (
FOREIGN KEY (item_id) REFERENCES item (id) FOREIGN KEY (item_id) REFERENCES item (id)
); );
CREATE INDEX item_stat_item_id ON item_stat (item_id);
CREATE INDEX item_stat_stat ON item_stat (stat); CREATE INDEX item_stat_stat ON item_stat (stat);
CREATE TABLE item_affix ( CREATE TABLE item_affix (
@@ -87,3 +87,4 @@ CREATE TABLE item_affix (
FOREIGN KEY (item_id) REFERENCES item (id) FOREIGN KEY (item_id) REFERENCES item (id)
); );
CREATE INDEX item_affix_item_id ON item_affix (item_id);