Add table indexes
This commit is contained in:
parent
0140c9c889
commit
0f0abcd66e
1 changed files with 16 additions and 10 deletions
26
tables.sql
26
tables.sql
|
@ -1,12 +1,3 @@
|
|||
CREATE TABLE IF NOT EXISTS `copies` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`collection` TEXT NOT NULL DEFAULT 'Default',
|
||||
`scryfall_id` TEXT,
|
||||
`isFoil` INTEGER NOT NULL DEFAULT 0,
|
||||
`language` TEXT,
|
||||
`condition` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `cards` (
|
||||
`scryfall_id` TEXT PRIMARY KEY,
|
||||
`name` TEXT NOT NULL,
|
||||
|
@ -24,6 +15,20 @@ CREATE TABLE IF NOT EXISTS `cards` (
|
|||
`oracle_text` TEXT
|
||||
);
|
||||
|
||||
CREATE INDEX `cards_name` ON `cards`(`name` COLLATE nocase);
|
||||
CREATE INDEX `cards_rarity` ON `cards`(`rarity`);
|
||||
CREATE INDEX `cards_color_identity` ON `cards`(`color_identity`);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `copies` (
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`collection` TEXT NOT NULL DEFAULT 'Default',
|
||||
`scryfall_id` TEXT,
|
||||
`isFoil` INTEGER NOT NULL DEFAULT 0,
|
||||
`language` TEXT,
|
||||
`condition` TEXT,
|
||||
FOREIGN KEY (`scryfall_id`) REFERENCES `cards`(`scryfall_id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `card_prices` (
|
||||
`scryfall_id` TEXT,
|
||||
`date` TEXT,
|
||||
|
@ -32,7 +37,8 @@ CREATE TABLE IF NOT EXISTS `card_prices` (
|
|||
`eur` TEXT, -- Decimal value
|
||||
`eur_foil` TEXT, -- Decimal value
|
||||
`tix` TEXT, -- Decimal value
|
||||
PRIMARY KEY (`scryfall_id`, `date`)
|
||||
PRIMARY KEY (`scryfall_id`, `date`),
|
||||
FOREIGN KEY (`scryfall_id`) REFERENCES `cards`(`scryfall_id`)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sets` (
|
||||
|
|
Loading…
Reference in a new issue