forked from 2sys/phonograph
35 lines
1.4 KiB
MySQL
35 lines
1.4 KiB
MySQL
|
|
create table if not exists form_transitions (
|
||
|
|
id uuid not null primary key default uuidv7(),
|
||
|
|
source_id uuid not null references portals(id) on delete cascade,
|
||
|
|
dest_id uuid not null references portals(id) on delete restrict,
|
||
|
|
condition jsonb not null default 'null'
|
||
|
|
);
|
||
|
|
create index on form_transitions (source_id);
|
||
|
|
|
||
|
|
create table if not exists field_form_prompts (
|
||
|
|
id uuid not null primary key default uuidv7(),
|
||
|
|
field_id uuid not null references fields(id) on delete cascade,
|
||
|
|
language text not null,
|
||
|
|
content text not null default '',
|
||
|
|
unique (field_id, language)
|
||
|
|
);
|
||
|
|
create index on field_form_prompts (field_id);
|
||
|
|
|
||
|
|
create table if not exists form_sessions (
|
||
|
|
id uuid not null primary key default uuidv7(),
|
||
|
|
user_id uuid references users(id) on delete cascade
|
||
|
|
);
|
||
|
|
|
||
|
|
create table if not exists form_touch_points (
|
||
|
|
id uuid not null primary key default uuidv7(),
|
||
|
|
-- `on delete restrict` errs on the side of conservatism, but is not known
|
||
|
|
-- to be crucial.
|
||
|
|
form_session_id uuid not null references form_sessions(id) on delete restrict,
|
||
|
|
-- `on delete restrict` errs on the side of conservatism, but is not known
|
||
|
|
-- to be crucial.
|
||
|
|
portal_id uuid not null references portals(id) on delete restrict,
|
||
|
|
-- Points to a row in the portal's backing table, so foreign key constraints
|
||
|
|
-- do not apply here.
|
||
|
|
row_id uuid not null
|
||
|
|
);
|