@@ -27,6 +27,13 @@ export const preparePostgresDB = async (
27
27
credentials : PostgresCredentials ,
28
28
) : Promise <
29
29
DB & {
30
+ packageName :
31
+ | '@aws-sdk/client-rds-data'
32
+ | 'pglite'
33
+ | 'pg'
34
+ | 'postgres'
35
+ | '@vercel/postgres'
36
+ | '@neondatabase/serverless' ;
30
37
proxy : Proxy ;
31
38
transactionProxy : TransactionProxy ;
32
39
migrate : ( config : string | MigrationConfig ) => Promise < void > ;
@@ -102,6 +109,7 @@ export const preparePostgresDB = async (
102
109
} ;
103
110
104
111
return {
112
+ packageName : '@aws-sdk/client-rds-data' ,
105
113
query,
106
114
proxy,
107
115
transactionProxy,
@@ -162,7 +170,7 @@ export const preparePostgresDB = async (
162
170
return results ;
163
171
} ;
164
172
165
- return { query, proxy, transactionProxy, migrate : migrateFn } ;
173
+ return { packageName : 'pglite' , query, proxy, transactionProxy, migrate : migrateFn } ;
166
174
}
167
175
168
176
assertUnreachable ( driver ) ;
@@ -255,7 +263,7 @@ export const preparePostgresDB = async (
255
263
return results ;
256
264
} ;
257
265
258
- return { query, proxy, transactionProxy, migrate : migrateFn } ;
266
+ return { packageName : 'pg' , query, proxy, transactionProxy, migrate : migrateFn } ;
259
267
}
260
268
261
269
if ( await checkPackage ( 'postgres' ) ) {
@@ -313,7 +321,7 @@ export const preparePostgresDB = async (
313
321
return results ;
314
322
} ;
315
323
316
- return { query, proxy, transactionProxy, migrate : migrateFn } ;
324
+ return { packageName : 'postgres' , query, proxy, transactionProxy, migrate : migrateFn } ;
317
325
}
318
326
319
327
if ( await checkPackage ( '@vercel/postgres' ) ) {
@@ -411,7 +419,7 @@ export const preparePostgresDB = async (
411
419
return results ;
412
420
} ;
413
421
414
- return { query, proxy, transactionProxy, migrate : migrateFn } ;
422
+ return { packageName : '@vercel/postgres' , query, proxy, transactionProxy, migrate : migrateFn } ;
415
423
}
416
424
417
425
if ( await checkPackage ( '@neondatabase/serverless' ) ) {
@@ -511,7 +519,7 @@ export const preparePostgresDB = async (
511
519
return results ;
512
520
} ;
513
521
514
- return { query, proxy, transactionProxy, migrate : migrateFn } ;
522
+ return { packageName : '@neondatabase/serverless' , query, proxy, transactionProxy, migrate : migrateFn } ;
515
523
}
516
524
517
525
console . error (
@@ -524,6 +532,7 @@ export const prepareGelDB = async (
524
532
credentials ?: GelCredentials ,
525
533
) : Promise <
526
534
DB & {
535
+ packageName : 'gel' ;
527
536
proxy : Proxy ;
528
537
transactionProxy : TransactionProxy ;
529
538
}
@@ -593,7 +602,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
593
602
return result ;
594
603
} ;
595
604
596
- return { query, proxy, transactionProxy } ;
605
+ return { packageName : 'gel' , query, proxy, transactionProxy } ;
597
606
}
598
607
599
608
console . error (
@@ -629,6 +638,7 @@ export const connectToSingleStore = async (
629
638
it : SingleStoreCredentials ,
630
639
) : Promise < {
631
640
db : DB ;
641
+ packageName : 'mysql2' ;
632
642
proxy : Proxy ;
633
643
transactionProxy : TransactionProxy ;
634
644
database : string ;
@@ -686,6 +696,7 @@ export const connectToSingleStore = async (
686
696
687
697
return {
688
698
db : { query } ,
699
+ packageName : 'mysql2' ,
689
700
proxy,
690
701
transactionProxy,
691
702
database : result . database ,
@@ -694,7 +705,7 @@ export const connectToSingleStore = async (
694
705
}
695
706
696
707
console . error (
697
- "To connect to SingleStore database - please install 'singlestore ' driver" ,
708
+ "To connect to SingleStore database - please install 'mysql2 ' driver" ,
698
709
) ;
699
710
process . exit ( 1 ) ;
700
711
} ;
@@ -726,6 +737,7 @@ export const connectToMySQL = async (
726
737
it : MysqlCredentials ,
727
738
) : Promise < {
728
739
db : DB ;
740
+ packageName : 'mysql2' | '@planetscale/database' ;
729
741
proxy : Proxy ;
730
742
transactionProxy : TransactionProxy ;
731
743
database : string ;
@@ -795,6 +807,7 @@ export const connectToMySQL = async (
795
807
796
808
return {
797
809
db : { query } ,
810
+ packageName : 'mysql2' ,
798
811
proxy,
799
812
transactionProxy,
800
813
database : result . database ,
@@ -846,6 +859,7 @@ export const connectToMySQL = async (
846
859
847
860
return {
848
861
db : { query } ,
862
+ packageName : '@planetscale/database' ,
849
863
proxy,
850
864
transactionProxy,
851
865
database : result . database ,
@@ -905,7 +919,12 @@ export const connectToSQLite = async (
905
919
credentials : SqliteCredentials ,
906
920
) : Promise <
907
921
& SQLiteDB
908
- & { migrate : ( config : MigrationConfig ) => Promise < void > ; proxy : Proxy ; transactionProxy : TransactionProxy }
922
+ & {
923
+ packageName : 'd1-http' | '@libsql/client' | 'better-sqlite3' ;
924
+ migrate : ( config : MigrationConfig ) => Promise < void > ;
925
+ proxy : Proxy ;
926
+ transactionProxy : TransactionProxy ;
927
+ }
909
928
> => {
910
929
if ( 'driver' in credentials ) {
911
930
const { driver } = credentials ;
@@ -1037,7 +1056,7 @@ export const connectToSQLite = async (
1037
1056
const result = await remoteBatchCallback ( queries ) ;
1038
1057
return result . rows ;
1039
1058
} ;
1040
- return { ...db , proxy, transactionProxy, migrate : migrateFn } ;
1059
+ return { ...db , packageName : 'd1-http' , proxy, transactionProxy, migrate : migrateFn } ;
1041
1060
} else {
1042
1061
assertUnreachable ( driver ) ;
1043
1062
}
@@ -1101,7 +1120,7 @@ export const connectToSQLite = async (
1101
1120
return results ;
1102
1121
} ;
1103
1122
1104
- return { ...db , proxy, transactionProxy, migrate : migrateFn } ;
1123
+ return { ...db , packageName : '@libsql/client' , proxy, transactionProxy, migrate : migrateFn } ;
1105
1124
}
1106
1125
1107
1126
if ( await checkPackage ( 'better-sqlite3' ) ) {
@@ -1170,7 +1189,7 @@ export const connectToSQLite = async (
1170
1189
return results ;
1171
1190
} ;
1172
1191
1173
- return { ...db , proxy, transactionProxy, migrate : migrateFn } ;
1192
+ return { ...db , packageName : 'better-sqlite3' , proxy, transactionProxy, migrate : migrateFn } ;
1174
1193
}
1175
1194
1176
1195
console . log (
@@ -1181,7 +1200,12 @@ export const connectToSQLite = async (
1181
1200
1182
1201
export const connectToLibSQL = async ( credentials : LibSQLCredentials ) : Promise <
1183
1202
& LibSQLDB
1184
- & { migrate : ( config : MigrationConfig ) => Promise < void > ; proxy : Proxy ; transactionProxy : TransactionProxy }
1203
+ & {
1204
+ packageName : '@libsql/client' ;
1205
+ migrate : ( config : MigrationConfig ) => Promise < void > ;
1206
+ proxy : Proxy ;
1207
+ transactionProxy : TransactionProxy ;
1208
+ }
1185
1209
> => {
1186
1210
if ( await checkPackage ( '@libsql/client' ) ) {
1187
1211
const { createClient } = await import ( '@libsql/client' ) ;
@@ -1245,7 +1269,7 @@ export const connectToLibSQL = async (credentials: LibSQLCredentials): Promise<
1245
1269
return results ;
1246
1270
} ;
1247
1271
1248
- return { ...db , proxy, transactionProxy, migrate : migrateFn } ;
1272
+ return { ...db , packageName : '@libsql/client' , proxy, transactionProxy, migrate : migrateFn } ;
1249
1273
}
1250
1274
1251
1275
console . log (
0 commit comments