canape/sql/migration/0002_external_medias.up.sql
Lucas BEE ab7503997f Add Torrents
Change the DB to store torrents in database
Add Torrenters to the party
Add raw links to movie Torrents in the web interface
Change the way explore works with multiple source and categories with external_medias
Delete StringSlice and use pq StringArray type to avoid problems
2016-12-08 16:07:08 +00:00

17 lines
703 B
SQL

CREATE TYPE media_type AS ENUM ('movie', 'show');
CREATE TYPE media_category AS ENUM ('trending', 'popular', 'anticipated', 'box_office');
CREATE TYPE media_source AS ENUM ('trakttv', 'yts');
CREATE TABLE external_medias (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
type media_type NOT NULL,
source media_source NOT NULL,
category media_category NOT NULL,
ids text[] NOT NULL,
LIKE base INCLUDING DEFAULTS
);
CREATE TRIGGER update_external_medias_updated_at BEFORE UPDATE ON external_medias FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();
CREATE UNIQUE INDEX ON external_medias (type, source, category);
CREATE INDEX ON external_medias (type, source, category);