mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
feat(artwork): add artwork, item_artwork and artwork_queue tables
This commit is contained in:
parent
62257527d7
commit
7aacb01f4f
41
db/migrations/20260722023032_add_artwork_tables.sql
Normal file
41
db/migrations/20260722023032_add_artwork_tables.sql
Normal file
@ -0,0 +1,41 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE artwork (
|
||||
hash TEXT PRIMARY KEY,
|
||||
mime TEXT NOT NULL,
|
||||
width INTEGER NOT NULL DEFAULT 0,
|
||||
height INTEGER NOT NULL DEFAULT 0,
|
||||
size_bytes INTEGER NOT NULL DEFAULT 0,
|
||||
blur_hash TEXT NOT NULL DEFAULT '',
|
||||
source_path TEXT NOT NULL DEFAULT '',
|
||||
ref_mtime INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE item_artwork (
|
||||
item_kind TEXT NOT NULL,
|
||||
item_id TEXT NOT NULL,
|
||||
image_type TEXT NOT NULL DEFAULT 'primary',
|
||||
hash TEXT NOT NULL DEFAULT '',
|
||||
source TEXT NOT NULL DEFAULT '',
|
||||
attempted_at TIMESTAMP,
|
||||
updated_at TIMESTAMP,
|
||||
PRIMARY KEY (item_kind, item_id, image_type)
|
||||
) WITHOUT ROWID;
|
||||
CREATE INDEX ix_item_artwork_hash ON item_artwork(hash);
|
||||
|
||||
CREATE TABLE artwork_queue (
|
||||
item_kind TEXT NOT NULL,
|
||||
item_id TEXT NOT NULL,
|
||||
image_type TEXT NOT NULL DEFAULT 'primary',
|
||||
priority INTEGER NOT NULL DEFAULT 0,
|
||||
attempts INTEGER NOT NULL DEFAULT 0,
|
||||
retry_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
enqueued_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (item_kind, item_id, image_type)
|
||||
) WITHOUT ROWID;
|
||||
CREATE INDEX ix_artwork_queue_drain ON artwork_queue(retry_at, priority, enqueued_at);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE artwork_queue;
|
||||
DROP TABLE item_artwork;
|
||||
DROP TABLE artwork;
|
||||
Loading…
x
Reference in New Issue
Block a user