Files
alla-allaos-fullstack/drizzle_bk/0018_report_foundation.sql
phaichayon 0c28735c90 task-d.5.3
2026-06-24 14:23:15 +07:00

16 lines
571 B
SQL

CREATE TABLE IF NOT EXISTS "crm_report_definitions" (
"id" text PRIMARY KEY NOT NULL,
"organization_id" text NOT NULL,
"code" text NOT NULL,
"name" text NOT NULL,
"description" text,
"category" text NOT NULL,
"is_system" boolean DEFAULT true NOT NULL,
"is_active" boolean DEFAULT true NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS "crm_report_definitions_org_code_idx"
ON "crm_report_definitions" ("organization_id", "code");