Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE field_groups (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
company_id UUID NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
description TEXT,
|
||||
"order" INT NOT NULL DEFAULT 0,
|
||||
is_system BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX field_groups_company_id_idx ON field_groups(company_id);
|
||||
|
||||
CREATE TABLE standard_fields (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
company_id UUID NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
group_id UUID NOT NULL REFERENCES field_groups(id) ON DELETE CASCADE,
|
||||
is_required BOOLEAN NOT NULL DEFAULT false,
|
||||
description TEXT,
|
||||
default_value TEXT,
|
||||
validation JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
is_system BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE (company_id, key)
|
||||
);
|
||||
|
||||
CREATE INDEX standard_fields_company_id_idx ON standard_fields(company_id);
|
||||
CREATE INDEX standard_fields_group_id_idx ON standard_fields(group_id);
|
||||
|
||||
CREATE TABLE structured_description_fields (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
company_id UUID NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
|
||||
field_key TEXT NOT NULL,
|
||||
type TEXT NOT NULL DEFAULT 'text',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE (company_id, field_key)
|
||||
);
|
||||
|
||||
CREATE INDEX structured_description_fields_company_id_idx ON structured_description_fields(company_id);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS standard_fields;
|
||||
DROP TABLE IF EXISTS structured_description_fields;
|
||||
DROP TABLE IF EXISTS field_groups;
|
||||
Reference in New Issue
Block a user