You've already forked testing-go-code-with-postgres
mirror of
https://github.com/xorcare/testing-go-code-with-postgres.git
synced 2025-06-30 23:23:40 +02:00
Fix placeholder for the database template name
When a template database name contains invalid characters such as `-`, the request to create a new database stops working. To reduce this behavior, quotation marks have been added.
This commit is contained in:
@ -7,7 +7,7 @@ function create_user_and_database() {
|
|||||||
local database=$1
|
local database=$1
|
||||||
echo " Creating user and database '$database'"
|
echo " Creating user and database '$database'"
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
||||||
CREATE DATABASE $database OWNER $POSTGRES_USER;
|
CREATE DATABASE "$database" OWNER $POSTGRES_USER;
|
||||||
EOSQL
|
EOSQL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (p *Postgres) cloneFromReference() *Postgres {
|
|||||||
newDatabaseName := uuid.New().String()
|
newDatabaseName := uuid.New().String()
|
||||||
|
|
||||||
sql := fmt.Sprintf(
|
sql := fmt.Sprintf(
|
||||||
`CREATE DATABASE %q WITH TEMPLATE %s;`,
|
`CREATE DATABASE %q WITH TEMPLATE %q;`,
|
||||||
newDatabaseName,
|
newDatabaseName,
|
||||||
p.ref,
|
p.ref,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user