You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mediarepo/mediarepo-daemon/mediarepo-database/migrations/20211012165523_add-thumbnai...

14 lines
505 B
SQL

-- Add migration script here
CREATE TABLE thumbnails (
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash_id INTEGER UNIQUE NOT NULL,
storage_id INTEGER NOT NULL,
file_id INTEGER NOT NULL,
height INTEGER NOT NULL,
width INTEGER NOT NULL,
FOREIGN KEY (hash_id) REFERENCES hashes (id),
FOREIGN KEY (storage_id) REFERENCES storage_locations (id),
FOREIGN KEY (file_id) REFERENCES files (id)
);
CREATE UNIQUE INDEX thumbnail_file_resolution ON thumbnails (file_id, height, width);