- Add agent-run module to handle AI interactions with tools and messages. - Create routes for proxying requests to OpenAI and Anthropic APIs. - Implement flowme-life chat route for user queries and task management. - Add services for retrieving and updating life records in the database. - Implement logic for fetching today's tasks and marking tasks as done with next execution time calculation. - Introduce tests for flowme-life functionalities.
505 lines
18 KiB
SQL
505 lines
18 KiB
SQL
CREATE TYPE "public"."enum_cf_router_code_type" AS ENUM('route', 'middleware');--> statement-breakpoint
|
|
CREATE TABLE "ai_agent" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"type" varchar(255) NOT NULL,
|
|
"baseUrl" varchar(255) NOT NULL,
|
|
"apiKey" varchar(255) NOT NULL,
|
|
"temperature" double precision,
|
|
"cache" varchar(255),
|
|
"cacheName" varchar(255),
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"model" varchar(255) NOT NULL,
|
|
"data" json DEFAULT '{}'::json,
|
|
"status" varchar(255) DEFAULT 'open',
|
|
"key" varchar(255) NOT NULL,
|
|
"description" text,
|
|
"deletedAt" timestamp with time zone,
|
|
CONSTRAINT "ai_agent_key_key" UNIQUE("key")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "apps_trades" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"out_trade_no" varchar(255) NOT NULL,
|
|
"money" integer NOT NULL,
|
|
"subject" text NOT NULL,
|
|
"status" varchar(255) DEFAULT 'WAIT_BUYER_PAY' NOT NULL,
|
|
"type" varchar(255) DEFAULT 'alipay' NOT NULL,
|
|
"data" jsonb DEFAULT '{"list":[]}'::jsonb,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
CONSTRAINT "apps_trades_out_trade_no_key" UNIQUE("out_trade_no")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "cf_orgs" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"username" varchar(255) NOT NULL,
|
|
"users" jsonb DEFAULT '[]'::jsonb,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"description" varchar(255),
|
|
CONSTRAINT "cf_orgs_username_key" UNIQUE("username")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "cf_router_code" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"path" varchar(255) NOT NULL,
|
|
"key" varchar(255) NOT NULL,
|
|
"active" boolean DEFAULT false,
|
|
"project" varchar(255) DEFAULT 'default',
|
|
"code" text DEFAULT '',
|
|
"type" "enum_cf_router_code_type" DEFAULT 'route',
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"middleware" varchar(255)[] DEFAULT '{"RRAY[]::character varying[])::character varying(25"}',
|
|
"next" varchar(255) DEFAULT '',
|
|
"exec" text DEFAULT '',
|
|
"data" json DEFAULT '{}'::json,
|
|
"validator" json DEFAULT '{}'::json,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "cf_user" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"username" varchar(255) NOT NULL,
|
|
"password" varchar(255),
|
|
"salt" varchar(255),
|
|
"needChangePassword" boolean DEFAULT false,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"description" text,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"deletedAt" timestamp with time zone,
|
|
"type" varchar(255) DEFAULT 'user',
|
|
"owner" uuid,
|
|
"orgId" uuid,
|
|
"email" varchar(255),
|
|
"avatar" text,
|
|
"nickname" text,
|
|
CONSTRAINT "cf_user_username_key" UNIQUE("username")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "cf_user_secrets" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"description" text,
|
|
"status" varchar(255) DEFAULT 'active',
|
|
"title" text,
|
|
"expiredTime" timestamp with time zone,
|
|
"token" varchar(255) DEFAULT '' NOT NULL,
|
|
"userId" uuid,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"orgId" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "chat_histories" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"data" json,
|
|
"chatId" uuid,
|
|
"chatPromptId" uuid,
|
|
"root" boolean DEFAULT false,
|
|
"show" boolean DEFAULT true,
|
|
"uid" varchar(255),
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"role" varchar(255) DEFAULT 'user'
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "chat_prompts" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" varchar(255) NOT NULL,
|
|
"description" text,
|
|
"data" json,
|
|
"key" varchar(255) DEFAULT '' NOT NULL,
|
|
"uid" varchar(255),
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "chat_sessions" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"data" json DEFAULT '{}'::json,
|
|
"chatPromptId" uuid,
|
|
"type" varchar(255) DEFAULT 'production',
|
|
"uid" varchar(255),
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"title" varchar(255) DEFAULT '',
|
|
"key" varchar(255)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "file_sync" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"name" varchar(255),
|
|
"hash" varchar(255),
|
|
"stat" jsonb DEFAULT '{}'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"checkedAt" timestamp with time zone,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_ai_chat_history" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"username" varchar(255) DEFAULT '' NOT NULL,
|
|
"model" varchar(255) DEFAULT '' NOT NULL,
|
|
"group" varchar(255) DEFAULT '' NOT NULL,
|
|
"title" varchar(255) DEFAULT '' NOT NULL,
|
|
"messages" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
"prompt_tokens" integer DEFAULT 0,
|
|
"total_tokens" integer DEFAULT 0,
|
|
"completion_tokens" integer DEFAULT 0,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"version" integer DEFAULT 0,
|
|
"type" varchar(255) DEFAULT 'keep' NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_app" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"version" varchar(255) DEFAULT '',
|
|
"key" varchar(255),
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"title" varchar(255) DEFAULT '',
|
|
"description" varchar(255) DEFAULT '',
|
|
"user" varchar(255),
|
|
"status" varchar(255) DEFAULT 'running',
|
|
"pid" uuid,
|
|
"proxy" boolean DEFAULT false,
|
|
CONSTRAINT "key_uid_unique" UNIQUE("key","uid")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_app_domain" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"domain" varchar(255) NOT NULL,
|
|
"appId" varchar(255),
|
|
"uid" varchar(255),
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"data" jsonb,
|
|
"status" varchar(255) DEFAULT 'running' NOT NULL,
|
|
CONSTRAINT "kv_app_domain_domain_key" UNIQUE("domain")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_app_list" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"data" json DEFAULT '{}'::json,
|
|
"version" varchar(255) DEFAULT '',
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"key" varchar(255),
|
|
"status" varchar(255) DEFAULT 'running'
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_config" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text DEFAULT '',
|
|
"key" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"hash" text DEFAULT ''
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_light_code" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"type" text DEFAULT 'render-js',
|
|
"code" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL,
|
|
"uid" uuid,
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"hash" text DEFAULT ''
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_github" (
|
|
"id" uuid PRIMARY KEY NOT NULL,
|
|
"title" varchar(255) DEFAULT '',
|
|
"githubToken" varchar(255) DEFAULT '',
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_packages" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"publish" jsonb DEFAULT '{}'::jsonb,
|
|
"expand" jsonb DEFAULT '{}'::jsonb,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_page" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" varchar(255) DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"type" varchar(255) DEFAULT '',
|
|
"data" json DEFAULT '{}'::json,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"publish" json DEFAULT '{}'::json
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_resource" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"name" varchar(255) DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"source" varchar(255) DEFAULT '',
|
|
"sourceId" varchar(255) DEFAULT '',
|
|
"version" varchar(255) DEFAULT '0.0.0',
|
|
"data" json DEFAULT '{}'::json,
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "kv_vip" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"userId" uuid NOT NULL,
|
|
"level" varchar(255) DEFAULT 'free',
|
|
"category" varchar(255) NOT NULL,
|
|
"startDate" timestamp with time zone,
|
|
"endDate" timestamp with time zone,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone,
|
|
"title" text DEFAULT '' NOT NULL,
|
|
"description" text DEFAULT '' NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "micro_apps_upload" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" varchar(255) DEFAULT '',
|
|
"description" varchar(255) DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"type" varchar(255) DEFAULT '',
|
|
"source" varchar(255) DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"share" boolean DEFAULT false,
|
|
"uname" varchar(255) DEFAULT '',
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "micro_mark" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"uname" varchar(255) DEFAULT '',
|
|
"uid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"cover" text DEFAULT '',
|
|
"thumbnail" text DEFAULT '',
|
|
"link" text DEFAULT '',
|
|
"summary" text DEFAULT '',
|
|
"markType" text DEFAULT 'md',
|
|
"config" jsonb DEFAULT '{}'::jsonb,
|
|
"puid" uuid,
|
|
"deletedAt" timestamp with time zone,
|
|
"version" integer DEFAULT 1,
|
|
"fileList" jsonb DEFAULT '[]'::jsonb,
|
|
"key" text DEFAULT ''
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "query_views" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"uid" uuid,
|
|
"title" text DEFAULT '',
|
|
"summary" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"link" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "router_views" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"uid" uuid,
|
|
"title" text DEFAULT '',
|
|
"summary" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"link" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"views" jsonb DEFAULT '[]'::jsonb,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "work_share_mark" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"title" text DEFAULT '',
|
|
"key" text DEFAULT '',
|
|
"markType" text DEFAULT 'md',
|
|
"description" text DEFAULT '',
|
|
"cover" text DEFAULT '',
|
|
"link" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"summary" text DEFAULT '',
|
|
"config" jsonb DEFAULT '{}'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"fileList" jsonb DEFAULT '[]'::jsonb,
|
|
"uname" varchar(255) DEFAULT '',
|
|
"version" integer DEFAULT 1,
|
|
"markedAt" timestamp with time zone,
|
|
"uid" uuid,
|
|
"puid" uuid,
|
|
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"deletedAt" timestamp with time zone
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "n_code_make" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"slug" text NOT NULL,
|
|
"resources" jsonb DEFAULT '[]'::jsonb,
|
|
"userId" uuid,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "n_code_shop" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"slug" text NOT NULL,
|
|
"title" text NOT NULL,
|
|
"tags" jsonb,
|
|
"link" text,
|
|
"description" text DEFAULT '' NOT NULL,
|
|
"data" jsonb,
|
|
"platform" text NOT NULL,
|
|
"userinfo" text,
|
|
"orderLink" text NOT NULL,
|
|
"userId" uuid,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "n_code_short_link" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"slug" text NOT NULL,
|
|
"code" text DEFAULT '' NOT NULL,
|
|
"type" text DEFAULT 'link' NOT NULL,
|
|
"version" text DEFAULT '1.0.0' NOT NULL,
|
|
"title" text DEFAULT '' NOT NULL,
|
|
"description" text DEFAULT '' NOT NULL,
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"userId" uuid,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "flowme" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"uid" uuid,
|
|
"title" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"summary" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"link" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"channelId" uuid,
|
|
"type" text DEFAULT '',
|
|
"source" text DEFAULT '',
|
|
"importance" integer DEFAULT 0,
|
|
"isArchived" boolean DEFAULT false,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "flowme_channels" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"uid" uuid,
|
|
"title" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"summary" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"link" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"key" text DEFAULT '',
|
|
"color" text DEFAULT '#007bff',
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "flowme_life" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"uid" uuid,
|
|
"title" text DEFAULT '',
|
|
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
"summary" text DEFAULT '',
|
|
"description" text DEFAULT '',
|
|
"link" text DEFAULT '',
|
|
"data" jsonb DEFAULT '{}'::jsonb,
|
|
"effectiveAt" timestamp with time zone,
|
|
"type" text DEFAULT '',
|
|
"prompt" text DEFAULT '',
|
|
"taskType" text DEFAULT '',
|
|
"taskResult" jsonb DEFAULT '{}'::jsonb,
|
|
"createdAt" timestamp DEFAULT now() NOT NULL,
|
|
"updatedAt" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "cf_prompts" ALTER COLUMN "parents" SET DATA TYPE text[];--> statement-breakpoint
|
|
ALTER TABLE "cf_prompts" ALTER COLUMN "parents" SET DEFAULT '{}';--> statement-breakpoint
|
|
ALTER TABLE "flowme" ADD CONSTRAINT "flowme_channelId_flowme_channels_id_fk" FOREIGN KEY ("channelId") REFERENCES "public"."flowme_channels"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "file_sync_name_idx" ON "file_sync" USING btree ("name");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "kv_app_key_uid" ON "kv_app" USING btree ("key","uid");--> statement-breakpoint
|
|
CREATE INDEX "query_views_uid_idx" ON "query_views" USING btree ("uid");--> statement-breakpoint
|
|
CREATE INDEX "query_title_idx" ON "query_views" USING btree ("title");--> statement-breakpoint
|
|
CREATE INDEX "router_views_uid_idx" ON "router_views" USING btree ("uid");--> statement-breakpoint
|
|
CREATE INDEX "router_title_idx" ON "router_views" USING btree ("title");--> statement-breakpoint
|
|
CREATE INDEX "router_views_views_idx" ON "router_views" USING gin ("views");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "n_code_make_idx_slug" ON "n_code_make" USING btree ("slug");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "n_code_shop_idx_slug" ON "n_code_shop" USING btree ("slug");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "n_code_short_idx_slug" ON "n_code_short_link" USING btree ("slug");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "n_code_short_idx_code" ON "n_code_short_link" USING btree ("code");--> statement-breakpoint
|
|
CREATE INDEX "flowme_uid_idx" ON "flowme" USING btree ("uid");--> statement-breakpoint
|
|
CREATE INDEX "flowme_title_idx" ON "flowme" USING btree ("title");--> statement-breakpoint
|
|
CREATE INDEX "flowme_channel_id_idx" ON "flowme" USING btree ("channelId");--> statement-breakpoint
|
|
CREATE INDEX "flowme_channels_uid_idx" ON "flowme_channels" USING btree ("uid");--> statement-breakpoint
|
|
CREATE INDEX "flowme_channels_key_idx" ON "flowme_channels" USING btree ("key");--> statement-breakpoint
|
|
CREATE INDEX "flowme_channels_title_idx" ON "flowme_channels" USING btree ("title");--> statement-breakpoint
|
|
CREATE INDEX "life_uid_idx" ON "flowme_life" USING btree ("uid");--> statement-breakpoint
|
|
CREATE INDEX "life_title_idx" ON "flowme_life" USING btree ("title");--> statement-breakpoint
|
|
CREATE INDEX "life_effective_at_idx" ON "flowme_life" USING btree ("effectiveAt");--> statement-breakpoint
|
|
CREATE INDEX "life_summary_idx" ON "flowme_life" USING btree ("summary");--> statement-breakpoint
|
|
CREATE INDEX "prompts_parents_idx" ON "cf_prompts" USING gin ("parents"); |