Skip to content

Commit 1d83c9e

Browse files
committed
migration
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
1 parent 59b4915 commit 1d83c9e

11 files changed

Lines changed: 1207 additions & 14 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig } from "drizzle-kit";
2+
3+
export default defineConfig({
4+
schema: "./src/chat-plugin/schema.ts",
5+
out: "./drizzle",
6+
dialect: "postgresql",
7+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
CREATE SCHEMA IF NOT EXISTS "ai_chatbot";
2+
--> statement-breakpoint
3+
CREATE TABLE "ai_chatbot"."Chat" (
4+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
5+
"createdAt" timestamp NOT NULL,
6+
"title" text NOT NULL,
7+
"userId" text NOT NULL,
8+
"visibility" varchar DEFAULT 'private' NOT NULL,
9+
"lastContext" jsonb
10+
);
11+
--> statement-breakpoint
12+
CREATE TABLE "ai_chatbot"."Message" (
13+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
14+
"chatId" uuid NOT NULL,
15+
"role" varchar NOT NULL,
16+
"parts" json NOT NULL,
17+
"attachments" json NOT NULL,
18+
"createdAt" timestamp NOT NULL,
19+
"traceId" text
20+
);
21+
--> statement-breakpoint
22+
CREATE TABLE "ai_chatbot"."Vote" (
23+
"chatId" uuid NOT NULL,
24+
"messageId" uuid NOT NULL,
25+
"isUpvoted" boolean NOT NULL,
26+
CONSTRAINT "Vote_chatId_messageId_pk" PRIMARY KEY("chatId","messageId")
27+
);
28+
--> statement-breakpoint
29+
ALTER TABLE "ai_chatbot"."Message" ADD CONSTRAINT "Message_chatId_Chat_id_fk" FOREIGN KEY ("chatId") REFERENCES "ai_chatbot"."Chat"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
30+
ALTER TABLE "ai_chatbot"."Vote" ADD CONSTRAINT "Vote_chatId_Chat_id_fk" FOREIGN KEY ("chatId") REFERENCES "ai_chatbot"."Chat"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
31+
ALTER TABLE "ai_chatbot"."Vote" ADD CONSTRAINT "Vote_messageId_Message_id_fk" FOREIGN KEY ("messageId") REFERENCES "ai_chatbot"."Message"("id") ON DELETE no action ON UPDATE no action;
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{
2+
"id": "e4170b9c-f66a-4ebf-bf8a-365378173224",
3+
"prevId": "00000000-0000-0000-0000-000000000000",
4+
"version": "7",
5+
"dialect": "postgresql",
6+
"tables": {
7+
"ai_chatbot.Chat": {
8+
"name": "Chat",
9+
"schema": "ai_chatbot",
10+
"columns": {
11+
"id": {
12+
"name": "id",
13+
"type": "uuid",
14+
"primaryKey": true,
15+
"notNull": true,
16+
"default": "gen_random_uuid()"
17+
},
18+
"createdAt": {
19+
"name": "createdAt",
20+
"type": "timestamp",
21+
"primaryKey": false,
22+
"notNull": true
23+
},
24+
"title": {
25+
"name": "title",
26+
"type": "text",
27+
"primaryKey": false,
28+
"notNull": true
29+
},
30+
"userId": {
31+
"name": "userId",
32+
"type": "text",
33+
"primaryKey": false,
34+
"notNull": true
35+
},
36+
"visibility": {
37+
"name": "visibility",
38+
"type": "varchar",
39+
"primaryKey": false,
40+
"notNull": true,
41+
"default": "'private'"
42+
},
43+
"lastContext": {
44+
"name": "lastContext",
45+
"type": "jsonb",
46+
"primaryKey": false,
47+
"notNull": false
48+
}
49+
},
50+
"indexes": {},
51+
"foreignKeys": {},
52+
"compositePrimaryKeys": {},
53+
"uniqueConstraints": {},
54+
"policies": {},
55+
"checkConstraints": {},
56+
"isRLSEnabled": false
57+
},
58+
"ai_chatbot.Message": {
59+
"name": "Message",
60+
"schema": "ai_chatbot",
61+
"columns": {
62+
"id": {
63+
"name": "id",
64+
"type": "uuid",
65+
"primaryKey": true,
66+
"notNull": true,
67+
"default": "gen_random_uuid()"
68+
},
69+
"chatId": {
70+
"name": "chatId",
71+
"type": "uuid",
72+
"primaryKey": false,
73+
"notNull": true
74+
},
75+
"role": {
76+
"name": "role",
77+
"type": "varchar",
78+
"primaryKey": false,
79+
"notNull": true
80+
},
81+
"parts": {
82+
"name": "parts",
83+
"type": "json",
84+
"primaryKey": false,
85+
"notNull": true
86+
},
87+
"attachments": {
88+
"name": "attachments",
89+
"type": "json",
90+
"primaryKey": false,
91+
"notNull": true
92+
},
93+
"createdAt": {
94+
"name": "createdAt",
95+
"type": "timestamp",
96+
"primaryKey": false,
97+
"notNull": true
98+
},
99+
"traceId": {
100+
"name": "traceId",
101+
"type": "text",
102+
"primaryKey": false,
103+
"notNull": false
104+
}
105+
},
106+
"indexes": {},
107+
"foreignKeys": {
108+
"Message_chatId_Chat_id_fk": {
109+
"name": "Message_chatId_Chat_id_fk",
110+
"tableFrom": "Message",
111+
"tableTo": "Chat",
112+
"schemaTo": "ai_chatbot",
113+
"columnsFrom": [
114+
"chatId"
115+
],
116+
"columnsTo": [
117+
"id"
118+
],
119+
"onDelete": "no action",
120+
"onUpdate": "no action"
121+
}
122+
},
123+
"compositePrimaryKeys": {},
124+
"uniqueConstraints": {},
125+
"policies": {},
126+
"checkConstraints": {},
127+
"isRLSEnabled": false
128+
},
129+
"ai_chatbot.Vote": {
130+
"name": "Vote",
131+
"schema": "ai_chatbot",
132+
"columns": {
133+
"chatId": {
134+
"name": "chatId",
135+
"type": "uuid",
136+
"primaryKey": false,
137+
"notNull": true
138+
},
139+
"messageId": {
140+
"name": "messageId",
141+
"type": "uuid",
142+
"primaryKey": false,
143+
"notNull": true
144+
},
145+
"isUpvoted": {
146+
"name": "isUpvoted",
147+
"type": "boolean",
148+
"primaryKey": false,
149+
"notNull": true
150+
}
151+
},
152+
"indexes": {},
153+
"foreignKeys": {
154+
"Vote_chatId_Chat_id_fk": {
155+
"name": "Vote_chatId_Chat_id_fk",
156+
"tableFrom": "Vote",
157+
"tableTo": "Chat",
158+
"schemaTo": "ai_chatbot",
159+
"columnsFrom": [
160+
"chatId"
161+
],
162+
"columnsTo": [
163+
"id"
164+
],
165+
"onDelete": "no action",
166+
"onUpdate": "no action"
167+
},
168+
"Vote_messageId_Message_id_fk": {
169+
"name": "Vote_messageId_Message_id_fk",
170+
"tableFrom": "Vote",
171+
"tableTo": "Message",
172+
"schemaTo": "ai_chatbot",
173+
"columnsFrom": [
174+
"messageId"
175+
],
176+
"columnsTo": [
177+
"id"
178+
],
179+
"onDelete": "no action",
180+
"onUpdate": "no action"
181+
}
182+
},
183+
"compositePrimaryKeys": {
184+
"Vote_chatId_messageId_pk": {
185+
"name": "Vote_chatId_messageId_pk",
186+
"columns": [
187+
"chatId",
188+
"messageId"
189+
]
190+
}
191+
},
192+
"uniqueConstraints": {},
193+
"policies": {},
194+
"checkConstraints": {},
195+
"isRLSEnabled": false
196+
}
197+
},
198+
"enums": {},
199+
"schemas": {},
200+
"sequences": {},
201+
"roles": {},
202+
"policies": {},
203+
"views": {},
204+
"_meta": {
205+
"columns": {},
206+
"schemas": {},
207+
"tables": {}
208+
}
209+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "7",
3+
"dialect": "postgresql",
4+
"entries": [
5+
{
6+
"idx": 0,
7+
"version": "7",
8+
"when": 1774365591071,
9+
"tag": "0000_lying_bill_hollister",
10+
"breakpoints": true
11+
}
12+
]
13+
}

integrations/appkit-agent/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"files": [
4343
"dist",
44+
"drizzle",
4445
"README.md",
4546
"LICENSE",
4647
"NOTICE"
@@ -111,6 +112,7 @@
111112
"@types/pg": "^8.16.0",
112113
"@types/react": "^19.0.0",
113114
"@types/react-dom": "^19.0.0",
115+
"drizzle-kit": "^0.31.10",
114116
"prettier": "^3.0.0",
115117
"react": "^19.0.0",
116118
"react-dom": "^19.0.0",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ── Databricks Authentication ──────────────────────────────────
2+
#
3+
# Option 1 (recommended): Databricks CLI profile
4+
# Run: databricks auth login --host <workspace-url> --profile DEFAULT
5+
# Then set:
6+
DATABRICKS_CONFIG_PROFILE=DEFAULT
7+
#
8+
# Option 2: Direct credentials
9+
DATABRICKS_HOST=https://e2-dogfood.staging.cloud.databricks.com
10+
# DATABRICKS_TOKEN=dapi...
11+
12+
# ── Agent Model ───────────────────────────────────────────────
13+
DATABRICKS_MODEL=databricks-claude-sonnet-4-5
14+
15+
# ── AppKit Server ─────────────────────────────────────────────
16+
DATABRICKS_APP_PORT=8000
17+
18+
POSTGRES_URL="postgres://hubert.zub@localhost:5432/hubert.zub"
19+
MLFLOW_EXPERIMENT_ID=/Users/your-email@company.com/chatbot-feedback-dev

0 commit comments

Comments
 (0)