Skip to content

Commit

Permalink
Merge branch 'master' into fix/keep-secret-name
Browse files Browse the repository at this point in the history
  • Loading branch information
hitman99 authored Nov 15, 2023
2 parents 7dcaae2 + 2a872dc commit d4a559b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/postgres/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ func (c *pg) CreateSchema(db, role, schema string, logger logr.Logger) error {
}

func (c *pg) DropDatabase(database string, logger logr.Logger) error {
_, err := c.db.Exec(fmt.Sprintf(DROP_DATABASE, database))
_, err := c.db.Exec(fmt.Sprintf(REVOKE_CONNECT, database))
// Error code 3D000 is returned if database doesn't exist
if err != nil && err.(*pq.Error).Code != "3D000" {
return err
}

_, err = c.db.Exec(fmt.Sprintf(TERMINATE_BACKEND, database))
// Error code 3D000 is returned if database doesn't exist
if err != nil && err.(*pq.Error).Code != "3D000" {
return err
}
_, err = c.db.Exec(fmt.Sprintf(DROP_DATABASE, database))
// Error code 3D000 is returned if database doesn't exist
if err != nil && err.(*pq.Error).Code != "3D000" {
return err
Expand Down

0 comments on commit d4a559b

Please sign in to comment.