feat: add asset variants table and URL selection
This commit is contained in:
20
packages/db/migrations/0003_asset_variants.sql
Normal file
20
packages/db/migrations/0003_asset_variants.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
CREATE TYPE IF NOT EXISTS asset_variant_kind AS ENUM (
|
||||
'thumb',
|
||||
'poster',
|
||||
'video_mp4'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS asset_variants (
|
||||
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
asset_id uuid NOT NULL REFERENCES assets(id) ON DELETE CASCADE,
|
||||
kind asset_variant_kind NOT NULL,
|
||||
size int NOT NULL,
|
||||
key text NOT NULL,
|
||||
mime_type text NOT NULL,
|
||||
width int,
|
||||
height int,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
UNIQUE(asset_id, kind, size)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS asset_variants_asset_id_idx ON asset_variants(asset_id);
|
||||
Reference in New Issue
Block a user