@@ -22,12 +22,12 @@ import (
22
22
"google.golang.org/protobuf/encoding/protojson"
23
23
24
24
"github.com/sqlc-dev/sqlc/internal/config"
25
+ "github.com/sqlc-dev/sqlc/internal/dbmanager"
25
26
"github.com/sqlc-dev/sqlc/internal/debug"
26
27
"github.com/sqlc-dev/sqlc/internal/migrations"
27
28
"github.com/sqlc-dev/sqlc/internal/opts"
28
29
"github.com/sqlc-dev/sqlc/internal/plugin"
29
30
"github.com/sqlc-dev/sqlc/internal/quickdb"
30
- pb "github.com/sqlc-dev/sqlc/internal/quickdb/v1"
31
31
"github.com/sqlc-dev/sqlc/internal/shfmt"
32
32
"github.com/sqlc-dev/sqlc/internal/sql/sqlpath"
33
33
"github.com/sqlc-dev/sqlc/internal/vet"
@@ -386,7 +386,7 @@ type checker struct {
386
386
Env * cel.Env
387
387
Stderr io.Writer
388
388
OnlyManagedDB bool
389
- Client pb. QuickClient
389
+ Client dbmanager. Client
390
390
Replacer * shfmt.Replacer
391
391
}
392
392
@@ -405,10 +405,7 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
405
405
406
406
if c .Client == nil {
407
407
// FIXME: Eventual race condition
408
- client , err := quickdb .NewClientFromConfig (c .Conf .Cloud )
409
- if err != nil {
410
- return "" , cleanup , fmt .Errorf ("managed: client: %w" , err )
411
- }
408
+ client := dbmanager .NewClient (c .Conf .Servers )
412
409
c .Client = client
413
410
}
414
411
@@ -425,22 +422,14 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
425
422
ddl = append (ddl , migrations .RemoveIgnoredStatements (string (contents )))
426
423
}
427
424
428
- resp , err := c .Client .CreateEphemeralDatabase (ctx , & pb. CreateEphemeralDatabaseRequest {
425
+ resp , err := c .Client .CreateDatabase (ctx , & dbmanager. CreateDatabaseRequest {
429
426
Engine : string (s .Engine ),
430
- Region : quickdb .GetClosestRegion (),
431
427
Migrations : ddl ,
432
428
})
433
429
if err != nil {
434
430
return "" , cleanup , fmt .Errorf ("managed: create database: %w" , err )
435
431
}
436
432
437
- cleanup = func () error {
438
- _ , err := c .Client .DropEphemeralDatabase (ctx , & pb.DropEphemeralDatabaseRequest {
439
- DatabaseId : resp .DatabaseId ,
440
- })
441
- return err
442
- }
443
-
444
433
var uri string
445
434
switch s .Engine {
446
435
case config .EngineMySQL :
0 commit comments