From ddce1f7aa354ee09c111fdf2a3a5fe1471190b1a Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 30 Sep 2025 08:32:42 -0600 Subject: [PATCH] write back logs --- .../drizzle/0113_write-back-logs-config.sql | 18 ++++++++++++++++++ .../{0112_snapshot.json => 0113_snapshot.json} | 4 ++-- packages/database/drizzle/meta/_journal.json | 7 +++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 packages/database/drizzle/0113_write-back-logs-config.sql rename packages/database/drizzle/meta/{0112_snapshot.json => 0113_snapshot.json} (99%) diff --git a/packages/database/drizzle/0113_write-back-logs-config.sql b/packages/database/drizzle/0113_write-back-logs-config.sql new file mode 100644 index 000000000..bf3957cb3 --- /dev/null +++ b/packages/database/drizzle/0113_write-back-logs-config.sql @@ -0,0 +1,18 @@ +CREATE TABLE "logs_write_back_configs" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "organization_id" uuid NOT NULL, + "data_source_id" uuid NOT NULL, + "database" varchar(255) NOT NULL, + "schema" varchar(255) NOT NULL, + "table_name" varchar(255) DEFAULT 'buster_query_logs' NOT NULL, + "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 "logs_write_back_configs" ADD CONSTRAINT "logs_write_back_configs_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "logs_write_back_configs" ADD CONSTRAINT "logs_write_back_configs_data_source_id_fkey" FOREIGN KEY ("data_source_id") REFERENCES "public"."data_sources"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "logs_write_back_configs_org_unique" ON "logs_write_back_configs" USING btree ("organization_id") WHERE "logs_write_back_configs"."deleted_at" IS NULL;--> statement-breakpoint +CREATE INDEX "idx_logs_write_back_configs_org_id" ON "logs_write_back_configs" USING btree ("organization_id" uuid_ops);--> statement-breakpoint +CREATE INDEX "idx_logs_write_back_configs_data_source_id" ON "logs_write_back_configs" USING btree ("data_source_id" uuid_ops);--> statement-breakpoint +CREATE INDEX "idx_logs_write_back_configs_deleted_at" ON "logs_write_back_configs" USING btree ("deleted_at"); \ No newline at end of file diff --git a/packages/database/drizzle/meta/0112_snapshot.json b/packages/database/drizzle/meta/0113_snapshot.json similarity index 99% rename from packages/database/drizzle/meta/0112_snapshot.json rename to packages/database/drizzle/meta/0113_snapshot.json index 04d173e9a..debe32f1d 100644 --- a/packages/database/drizzle/meta/0112_snapshot.json +++ b/packages/database/drizzle/meta/0113_snapshot.json @@ -1,5 +1,5 @@ { - "id": "e92f38f0-d150-427e-834f-5a9180da1c64", + "id": "cbab132e-3504-4b66-8c10-5da4a9c3d3ee", "prevId": "e99e0196-f7e5-4e83-ad36-ddf350e50805", "version": "7", "dialect": "postgresql", @@ -5494,7 +5494,7 @@ "type": "jsonb", "primaryKey": false, "notNull": true, - "default": "'{\"suggestedPrompts\":{\"report\":[\"provide a trend analysis of quarterly profits\",\"evaluate product performance across regions\"],\"dashboard\":[\"create a sales performance dashboard\",\"design a revenue forecast dashboard\"],\"visualization\":[\"create a metric for monthly sales\",\"show top vendors by purchase volume\"],\"help\":[\"what types of analyses can you perform?\",\"what questions can I as buster?\",\"what data models are available for queries?\",\"can you explain your forecasting capabilities?\"]},\"updatedAt\":\"2025-09-29T21:30:34.051Z\"}'::jsonb" + "default": "'{\"suggestedPrompts\":{\"report\":[\"provide a trend analysis of quarterly profits\",\"evaluate product performance across regions\"],\"dashboard\":[\"create a sales performance dashboard\",\"design a revenue forecast dashboard\"],\"visualization\":[\"create a metric for monthly sales\",\"show top vendors by purchase volume\"],\"help\":[\"what types of analyses can you perform?\",\"what questions can I as buster?\",\"what data models are available for queries?\",\"can you explain your forecasting capabilities?\"]},\"updatedAt\":\"2025-09-30T14:32:04.996Z\"}'::jsonb" }, "personalization_enabled": { "name": "personalization_enabled", diff --git a/packages/database/drizzle/meta/_journal.json b/packages/database/drizzle/meta/_journal.json index 7f93bcec0..998209aff 100644 --- a/packages/database/drizzle/meta/_journal.json +++ b/packages/database/drizzle/meta/_journal.json @@ -785,6 +785,13 @@ "when": 1759179073594, "tag": "0112_shortcuts_trigger_backfill", "breakpoints": true + }, + { + "idx": 113, + "version": "7", + "when": 1759242725045, + "tag": "0113_write-back-logs-config", + "breakpoints": true } ] } \ No newline at end of file