V3__track_media_ownership.sql
429 bytes
| 1 | create table media_asset ( |
|---|---|
| 2 | id uuid primary key, |
| 3 | owner_id uuid not null references app_user(id) on delete cascade, |
| 4 | filename varchar(80) not null unique, |
| 5 | content_type varchar(40) not null, |
| 6 | size_bytes bigint not null, |
| 7 | created_at timestamp with time zone not null, |
| 8 | constraint chk_media_size check (size_bytes > 0 and size_bytes <= 6291456) |
| 9 | ); |
| 10 | |
| 11 | create index idx_media_asset_owner on media_asset(owner_id); |
| 12 | |