diff --git a/cmd/initialise/sql/cockroach/01_user.sql b/cmd/initialise/sql/cockroach/01_user.sql index e9473e46c..4e621216c 100644 --- a/cmd/initialise/sql/cockroach/01_user.sql +++ b/cmd/initialise/sql/cockroach/01_user.sql @@ -1,2 +1,2 @@ -- replace %[1]s with the name of the user -CREATE USER IF NOT EXISTS %[1]s \ No newline at end of file +CREATE USER IF NOT EXISTS "%[1]s" \ No newline at end of file diff --git a/cmd/initialise/sql/cockroach/02_database.sql b/cmd/initialise/sql/cockroach/02_database.sql index 8d0e37e56..a0e3c3350 100644 --- a/cmd/initialise/sql/cockroach/02_database.sql +++ b/cmd/initialise/sql/cockroach/02_database.sql @@ -1,2 +1,2 @@ -- replace %[1]s with the name of the database -CREATE DATABASE IF NOT EXISTS %[1]s \ No newline at end of file +CREATE DATABASE IF NOT EXISTS "%[1]s" \ No newline at end of file diff --git a/cmd/initialise/sql/cockroach/03_grant_user.sql b/cmd/initialise/sql/cockroach/03_grant_user.sql index 161b2f5ba..de0d2743e 100644 --- a/cmd/initialise/sql/cockroach/03_grant_user.sql +++ b/cmd/initialise/sql/cockroach/03_grant_user.sql @@ -1,4 +1,4 @@ -- replace the first %[1]s with the database -- replace the second \%[2]s with the user -GRANT ALL ON DATABASE %[1]s TO %[2]s; -GRANT SYSTEM VIEWACTIVITY TO %[2]s; \ No newline at end of file +GRANT ALL ON DATABASE "%[1]s" TO "%[2]s"; +GRANT SYSTEM VIEWACTIVITY TO "%[2]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/cockroach/04_eventstore.sql b/cmd/initialise/sql/cockroach/04_eventstore.sql index fca432b3a..3cb4fc0d3 100644 --- a/cmd/initialise/sql/cockroach/04_eventstore.sql +++ b/cmd/initialise/sql/cockroach/04_eventstore.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS eventstore; -GRANT ALL ON ALL TABLES IN SCHEMA eventstore TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA eventstore TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/cockroach/05_projections.sql b/cmd/initialise/sql/cockroach/05_projections.sql index eafbda805..91ca6662e 100644 --- a/cmd/initialise/sql/cockroach/05_projections.sql +++ b/cmd/initialise/sql/cockroach/05_projections.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS projections; -GRANT ALL ON ALL TABLES IN SCHEMA projections TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA projections TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/cockroach/06_system.sql b/cmd/initialise/sql/cockroach/06_system.sql index f66c9dbe9..6c9138918 100644 --- a/cmd/initialise/sql/cockroach/06_system.sql +++ b/cmd/initialise/sql/cockroach/06_system.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS system; -GRANT ALL ON ALL TABLES IN SCHEMA system TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA system TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/01_user.sql b/cmd/initialise/sql/postgres/01_user.sql index 1afbce7ac..cd60b9a2c 100644 --- a/cmd/initialise/sql/postgres/01_user.sql +++ b/cmd/initialise/sql/postgres/01_user.sql @@ -1 +1 @@ -CREATE USER %[1]s \ No newline at end of file +CREATE USER "%[1]s" \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/02_database.sql b/cmd/initialise/sql/postgres/02_database.sql index 809d3b909..895a1f29d 100644 --- a/cmd/initialise/sql/postgres/02_database.sql +++ b/cmd/initialise/sql/postgres/02_database.sql @@ -1 +1 @@ -CREATE DATABASE %[1]s \ No newline at end of file +CREATE DATABASE "%[1]s" \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/03_grant_user.sql b/cmd/initialise/sql/postgres/03_grant_user.sql index f96cb22b6..13ce4ac4b 100644 --- a/cmd/initialise/sql/postgres/03_grant_user.sql +++ b/cmd/initialise/sql/postgres/03_grant_user.sql @@ -1,3 +1,3 @@ -- replace the first %[1]s with the database -- replace the second \%[2]s with the user -GRANT ALL ON DATABASE %[1]s TO %[2]s; \ No newline at end of file +GRANT ALL ON DATABASE "%[1]s" TO "%[2]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/04_eventstore.sql b/cmd/initialise/sql/postgres/04_eventstore.sql index fca432b3a..3cb4fc0d3 100644 --- a/cmd/initialise/sql/postgres/04_eventstore.sql +++ b/cmd/initialise/sql/postgres/04_eventstore.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS eventstore; -GRANT ALL ON ALL TABLES IN SCHEMA eventstore TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA eventstore TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/05_projections.sql b/cmd/initialise/sql/postgres/05_projections.sql index eafbda805..91ca6662e 100644 --- a/cmd/initialise/sql/postgres/05_projections.sql +++ b/cmd/initialise/sql/postgres/05_projections.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS projections; -GRANT ALL ON ALL TABLES IN SCHEMA projections TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA projections TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/sql/postgres/06_system.sql b/cmd/initialise/sql/postgres/06_system.sql index f66c9dbe9..6c9138918 100644 --- a/cmd/initialise/sql/postgres/06_system.sql +++ b/cmd/initialise/sql/postgres/06_system.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS system; -GRANT ALL ON ALL TABLES IN SCHEMA system TO %[1]s; \ No newline at end of file +GRANT ALL ON ALL TABLES IN SCHEMA system TO "%[1]s"; \ No newline at end of file diff --git a/cmd/initialise/verify_database_test.go b/cmd/initialise/verify_database_test.go index 627a9192c..ebdf0473b 100644 --- a/cmd/initialise/verify_database_test.go +++ b/cmd/initialise/verify_database_test.go @@ -26,7 +26,7 @@ func Test_verifyDB(t *testing.T) { name: "doesn't exists, create fails", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS zitadel", sql.ErrTxDone), + expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS \"zitadel\"", sql.ErrTxDone), ), database: "zitadel", }, @@ -36,7 +36,7 @@ func Test_verifyDB(t *testing.T) { name: "doesn't exists, create successful", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS zitadel", nil), + expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS \"zitadel\"", nil), ), database: "zitadel", }, @@ -46,7 +46,7 @@ func Test_verifyDB(t *testing.T) { name: "already exists", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS zitadel", nil), + expectExec("-- replace zitadel with the name of the database\nCREATE DATABASE IF NOT EXISTS \"zitadel\"", nil), ), database: "zitadel", }, diff --git a/cmd/initialise/verify_grant_test.go b/cmd/initialise/verify_grant_test.go index 93196037d..a6bfa818a 100644 --- a/cmd/initialise/verify_grant_test.go +++ b/cmd/initialise/verify_grant_test.go @@ -21,7 +21,7 @@ func Test_verifyGrant(t *testing.T) { name: "doesn't exists, create fails", args: args{ db: prepareDB(t, - expectExec("GRANT ALL ON DATABASE zitadel TO zitadel-user", sql.ErrTxDone), + expectExec("GRANT ALL ON DATABASE \"zitadel\" TO \"zitadel-user\"", sql.ErrTxDone), ), database: "zitadel", username: "zitadel-user", @@ -32,7 +32,7 @@ func Test_verifyGrant(t *testing.T) { name: "correct", args: args{ db: prepareDB(t, - expectExec("GRANT ALL ON DATABASE zitadel TO zitadel-user", nil), + expectExec("GRANT ALL ON DATABASE \"zitadel\" TO \"zitadel-user\"", nil), ), database: "zitadel", username: "zitadel-user", @@ -43,7 +43,7 @@ func Test_verifyGrant(t *testing.T) { name: "already exists", args: args{ db: prepareDB(t, - expectExec("GRANT ALL ON DATABASE zitadel TO zitadel-user", nil), + expectExec("GRANT ALL ON DATABASE \"zitadel\" TO \"zitadel-user\"", nil), ), database: "zitadel", username: "zitadel-user", diff --git a/cmd/initialise/verify_user_test.go b/cmd/initialise/verify_user_test.go index 0104319ac..da7afc176 100644 --- a/cmd/initialise/verify_user_test.go +++ b/cmd/initialise/verify_user_test.go @@ -27,7 +27,7 @@ func Test_verifyUser(t *testing.T) { name: "doesn't exists, create fails", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS zitadel-user", sql.ErrTxDone), + expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS \"zitadel-user\"", sql.ErrTxDone), ), username: "zitadel-user", password: "", @@ -38,7 +38,7 @@ func Test_verifyUser(t *testing.T) { name: "correct without password", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS zitadel-user", nil), + expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS \"zitadel-user\"", nil), ), username: "zitadel-user", password: "", @@ -49,7 +49,7 @@ func Test_verifyUser(t *testing.T) { name: "correct with password", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS zitadel-user WITH PASSWORD 'password'", nil), + expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS \"zitadel-user\" WITH PASSWORD 'password'", nil), ), username: "zitadel-user", password: "password", @@ -60,7 +60,7 @@ func Test_verifyUser(t *testing.T) { name: "already exists", args: args{ db: prepareDB(t, - expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS zitadel-user WITH PASSWORD 'password'", nil), + expectExec("-- replace zitadel-user with the name of the user\nCREATE USER IF NOT EXISTS \"zitadel-user\" WITH PASSWORD 'password'", nil), ), username: "zitadel-user", password: "", diff --git a/cmd/setup/07/logstore.sql b/cmd/setup/07/logstore.sql index b2df7f686..934ffa203 100644 --- a/cmd/setup/07/logstore.sql +++ b/cmd/setup/07/logstore.sql @@ -1,3 +1,3 @@ CREATE SCHEMA IF NOT EXISTS logstore; -GRANT ALL ON ALL TABLES IN SCHEMA logstore TO %[1]s; +GRANT ALL ON ALL TABLES IN SCHEMA logstore TO "%[1]s";