Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ func (ri *RelationalDatabaseImpl) CreateDatabase(
}
}

// Change database owner
if _, err := db.Exec(
fmt.Sprintf("ALTER DATABASE \"%s\" OWNER TO \"%s\";", info.Dbname, info.Username),
); err != nil {
return info, fmt.Errorf(
"create %s database error in change owner of database `%s`: %w", dbType, info.Dbname, err)
}

// Grant privileges
if _, err := db.Exec(
fmt.Sprintf("GRANT ALL PRIVILEGES ON DATABASE \"%s\" TO \"%s\"", info.Dbname, info.Username),
Expand Down
Loading