File tree Expand file tree Collapse file tree 3 files changed +27
-17
lines changed
Expand file tree Collapse file tree 3 files changed +27
-17
lines changed Original file line number Diff line number Diff line change 11import { config } from 'dotenv' ;
2- import { defineConfig } from 'drizzle-kit' ;
2+ import { defineConfig , type Config } from 'drizzle-kit' ;
3+ import { getDatabaseConfig } from './lib/db/drizzle' ;
34
45config ( { path : '.env.local' } ) ;
56
7+ const dbConfig = getDatabaseConfig ( ) ;
8+ const dbCredentials : Record < string , string | number | Record < string , any > > = {
9+ user : dbConfig . username ! ,
10+ password : dbConfig . password ,
11+ host : dbConfig . host ! ,
12+ port : dbConfig . port ,
13+ database : dbConfig . database ,
14+ } ;
15+
16+ if ( process . env . DATABASE_SSL_ROOT_CERT ) {
17+ dbCredentials . ssl = {
18+ ca : process . env . DATABASE_SSL_ROOT_CERT ,
19+ } ;
20+ }
21+
22+
623export default defineConfig ( {
7- dialect : 'postgresql' ,
8- dbCredentials : {
9- url : process . env . DATABASE_URL ! ,
10- } ,
11- schema : './lib/db/migrations/schema.ts' ,
12- out : './lib/db/migrations' ,
24+ dialect : "postgresql" ,
25+ dbCredentials,
26+ schema : "./lib/db/migrations/schema.ts" ,
27+ out : "./lib/db/migrations" ,
1328 entities : {
1429 roles : {
15- provider : ' supabase' ,
16- }
17- }
18- } ) ;
30+ provider : " supabase" ,
31+ } ,
32+ } ,
33+ } as Config ) ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ const getDatabaseConfigFromEnv = (): DatabaseConfig => {
6565} ;
6666
6767// Get database configuration from either DATABASE_URL or individual env vars
68- const getDatabaseConfig = ( ) : DatabaseConfig => {
68+ export const getDatabaseConfig = ( ) : DatabaseConfig => {
6969 if ( env . DATABASE_URL ) {
7070 return parseDatabaseUrl ( env . DATABASE_URL ) ;
7171 } else {
Original file line number Diff line number Diff line change 1- ALTER TABLE " tag_classes" DROP CONSTRAINT " tag_classes_name_project_id_unique" ;-- > statement-breakpoint
21ALTER TABLE " event_definitions" DROP CONSTRAINT " event_definitions_project_id_fkey" ;
32-- > statement-breakpoint
43ALTER TABLE " project_api_keys" ADD COLUMN " is_ingest_only" boolean DEFAULT false NOT NULL ;-- > statement-breakpoint
5- ALTER TABLE " tag_classes" DROP COLUMN " evaluator_runnable_graph" ;-- > statement-breakpoint
6- ALTER TABLE " tag_classes" DROP COLUMN " pipeline_version_id" ;-- > statement-breakpoint
7- ALTER TABLE " tags" DROP COLUMN " class_id" ;-- > statement-breakpoint
8- ALTER TABLE " tag_classes" ADD CONSTRAINT " label_classes_name_project_id_unique" UNIQUE(" name" ," project_id" );-- > statement-breakpoint
You can’t perform that action at this time.
0 commit comments