create table forms (
    id BIGINT IDENTITY (1,1) PRIMARY KEY,
    type nvarchar(100) not null,
    project_id bigint not null references projects(id),
    updated_at datetimeoffset
);

create index forms_project_id_idx on forms(project_id);

create table form_fields (
    id BIGINT IDENTITY (1,1) PRIMARY KEY,
    form_id bigint not null references forms(id),
    place integer,
    name nvarchar(500) not null,
    corresponding_field nvarchar(500),
    label nvarchar(1500),
    type nvarchar(100),
    enabled BIT not null default 0,
    required BIT not null  default 0,
    deleted BIT not null  default 0,
    deleted_at datetimeoffset,
    created_at datetimeoffset,
    updated_at datetimeoffset
);
create index form_fields_form_id_idx on form_fields(form_id);
