Skip to content

Commit f5857d0

Browse files
committed
chore: update drizzle dependencies and fix config
1 parent c5f5f87 commit f5857d0

6 files changed

Lines changed: 536 additions & 89 deletions

File tree

bun.lock

Lines changed: 37 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

drizzle.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Config } from 'drizzle-kit'
33
export default {
44
schema: './src/db/schema.ts',
55
out: './migrations',
6-
driver: 'd1',
6+
dialect: 'sqlite',
77
dbCredentials: {
88
wranglerConfigPath: './wrangler.jsonc',
99
dbName: 'core-github-api',

migrations/0000_natural_blade.sql

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
CREATE TABLE `gh_management_config` (
2+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3+
`timestamp` text DEFAULT 'CURRENT_TIMESTAMP' NOT NULL,
4+
`repo_name` text NOT NULL,
5+
`action` text NOT NULL,
6+
`status` text NOT NULL,
7+
`status_details` text,
8+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP'
9+
);
10+
--> statement-breakpoint
11+
CREATE INDEX `idx_gh_management_config_timestamp` ON `gh_management_config` (`timestamp`);--> statement-breakpoint
12+
CREATE INDEX `idx_gh_management_config_repo_name` ON `gh_management_config` (`repo_name`);--> statement-breakpoint
13+
CREATE INDEX `idx_gh_management_config_action` ON `gh_management_config` (`action`);--> statement-breakpoint
14+
CREATE INDEX `idx_gh_management_config_status` ON `gh_management_config` (`status`);--> statement-breakpoint
15+
CREATE TABLE `repo_analysis` (
16+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
17+
`session_id` text,
18+
`search_id` integer,
19+
`repo_full_name` text,
20+
`repo_url` text,
21+
`description` text,
22+
`relevancy_score` real,
23+
`analyzed_at` text DEFAULT 'CURRENT_TIMESTAMP',
24+
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`session_id`) ON UPDATE no action ON DELETE no action,
25+
FOREIGN KEY (`search_id`) REFERENCES `searches`(`id`) ON UPDATE no action ON DELETE no action
26+
);
27+
--> statement-breakpoint
28+
CREATE UNIQUE INDEX `repo_analysis_session_id_repo_full_name_unique` ON `repo_analysis` (`session_id`,`repo_full_name`);--> statement-breakpoint
29+
CREATE TABLE `request_logs` (
30+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
31+
`timestamp` text NOT NULL,
32+
`level` text NOT NULL,
33+
`message` text NOT NULL,
34+
`method` text NOT NULL,
35+
`path` text NOT NULL,
36+
`status` integer NOT NULL,
37+
`latency_ms` integer NOT NULL,
38+
`payload_size_bytes` integer NOT NULL,
39+
`correlation_id` text NOT NULL,
40+
`metadata` text
41+
);
42+
--> statement-breakpoint
43+
CREATE INDEX `idx_request_logs_timestamp` ON `request_logs` (`timestamp`);--> statement-breakpoint
44+
CREATE INDEX `idx_request_logs_correlation_id` ON `request_logs` (`correlation_id`);--> statement-breakpoint
45+
CREATE TABLE `searches` (
46+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
47+
`session_id` text,
48+
`search_term` text,
49+
`status` text DEFAULT 'pending',
50+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP',
51+
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`session_id`) ON UPDATE no action ON DELETE no action
52+
);
53+
--> statement-breakpoint
54+
CREATE TABLE `sessions` (
55+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
56+
`session_id` text,
57+
`prompt` text,
58+
`created_at` text DEFAULT 'CURRENT_TIMESTAMP'
59+
);
60+
--> statement-breakpoint
61+
CREATE UNIQUE INDEX `sessions_session_id_unique` ON `sessions` (`session_id`);

0 commit comments

Comments
 (0)