Skip to content

Commit e778598

Browse files
authored
cli: drop template db if it exist already (#2154)
1 parent 0202e32 commit e778598

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cli/daemon/sqldb/db.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ func (db *DB) Setup(ctx context.Context, appRoot string, dbMeta *meta.SQLDatabas
121121

122122
// Terminate the connections to the template database to prevent "database is being accessed by other users" errors.
123123
_ = db.terminateConnectionsToDB(ctx, db.ApplicationCloudName())
124+
if err := db.doDrop(ctx, tmplName); err != nil {
125+
return fmt.Errorf("drop db %s: %v", tmplName, err)
126+
}
127+
124128
if err := db.renameDB(ctx, db.ApplicationCloudName(), tmplName); err != nil {
125129
return fmt.Errorf("rename db %s to %s: %v", db.ApplicationCloudName(), tmplName, err)
126130
}

0 commit comments

Comments
 (0)