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

30 lines
1.1 KiB
SQL

CREATE TABLE "crm_document_artifacts" (
"id" text PRIMARY KEY NOT NULL,
"organization_id" text NOT NULL,
"entity_type" text NOT NULL,
"entity_id" text NOT NULL,
"document_type" text NOT NULL,
"artifact_type" text NOT NULL,
"template_version_id" text,
"storage_provider" text NOT NULL,
"storage_key" text NOT NULL,
"file_name" text NOT NULL,
"content_type" text NOT NULL,
"file_size" integer,
"checksum" text,
"status" text DEFAULT 'active' NOT NULL,
"generated_by" text NOT NULL,
"generated_at" timestamp with time zone DEFAULT now() NOT NULL,
"locked_at" timestamp with time zone,
"locked_by" text,
"voided_at" timestamp with time zone,
"voided_by" text,
"void_reason" text,
"metadata" jsonb,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
"deleted_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "memberships" ALTER COLUMN "business_role" SET DEFAULT 'sales_support';--> statement-breakpoint
ALTER TABLE "crm_quotations" ADD COLUMN "approved_artifact_id" text;