phonograph/interim-models/migrations/20250528233517_lenses.up.sql
2025-08-24 23:24:14 -07:00

21 lines
683 B
SQL

create type lens_display_type as enum ('table');
create table if not exists lenses (
id uuid not null primary key,
name text not null,
base_id uuid not null references bases(id) on delete cascade,
class_oid oid not null,
filter jsonb not null default 'null'::jsonb,
order_by jsonb not null default '[]'::jsonb,
display_type lens_display_type not null default 'table'
);
create index on lenses (base_id);
create table if not exists fields (
id uuid not null primary key,
lens_id uuid not null references lenses(id) on delete cascade,
name text not null,
label text,
field_type jsonb not null,
width_px int not null default 200
);