Files
silo-server/migrations/sql/081_series_root_match_queue.sql
T

25 lines
940 B
SQL
Raw Normal View History

-- +goose Up
-- +goose StatementBegin
2026-05-22 20:26:11 -04:00
CREATE TABLE IF NOT EXISTS series_root_match_queue (
media_folder_id INTEGER NOT NULL REFERENCES media_folders(id) ON DELETE CASCADE,
observed_root_path TEXT NOT NULL,
first_queued_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
last_attempted_at TIMESTAMPTZ NULL,
attempt_count INTEGER NOT NULL DEFAULT 0,
last_error TEXT NOT NULL DEFAULT '',
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (media_folder_id, observed_root_path)
);
CREATE INDEX IF NOT EXISTS idx_series_root_match_queue_attempt
ON series_root_match_queue (last_attempted_at ASC NULLS FIRST, media_folder_id, observed_root_path);
CREATE INDEX IF NOT EXISTS idx_series_root_match_queue_folder
ON series_root_match_queue (media_folder_id, observed_root_path);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS series_root_match_queue;
-- +goose StatementEnd