Skip to content

Commit 692d1df

Browse files
committed
Since postgresql 12+ postgres role is not recommanded to be used
1 parent c0c2c44 commit 692d1df

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

.github/workflows/ruby.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ jobs:
9191
postgres:
9292
image: postgres:17
9393
env:
94-
POSTGRES_USER: postgres
95-
POSTGRES_PASSWORD: postgres
94+
POSTGRES_USER: jruby
95+
POSTGRES_PASSWORD: jruby
9696
POSTGRES_HOST_AUTH_METHOD: trust
9797
ports:
9898
- 5432:5432
@@ -105,7 +105,7 @@ jobs:
105105
PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
106106
PGHOST: localhost
107107
PGPORT: 5432
108-
PGUSER: postgres
108+
PGUSER: jruby
109109

110110
steps:
111111
- uses: actions/checkout@v4
@@ -121,8 +121,8 @@ jobs:
121121
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
122122
- name: Setup database
123123
run: |
124-
psql -c "create database activerecord_unittest;" -U postgres
125-
psql -c "create database activerecord_unittest2;" -U postgres
124+
psql -c "create database activerecord_unittest;" -U jruby
125+
psql -c "create database activerecord_unittest2;" -U jruby
126126
- name: Build
127127
run: |
128128
rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
@@ -234,8 +234,8 @@ jobs:
234234
postgres:
235235
image: postgres:17
236236
env:
237-
POSTGRES_USER: postgres
238-
POSTGRES_PASSWORD: postgres
237+
POSTGRES_USER: jruby
238+
POSTGRES_PASSWORD: jruby
239239
POSTGRES_HOST_AUTH_METHOD: trust
240240
ports:
241241
- 5432:5432
@@ -249,7 +249,7 @@ jobs:
249249
INSERT_RETURNING: ${{ matrix.insert_returning }}
250250
PGHOST: localhost
251251
PGPORT: 5432
252-
PGUSER: postgres
252+
PGUSER: jruby
253253

254254
steps:
255255
- uses: actions/checkout@v4

rakelib/db.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CREATE DATABASE #{POSTGRES_CONFIG[:database]} OWNER #{POSTGRES_CONFIG[:username]
5353
ENCODING '#{POSTGRES_CONFIG[:encoding]}' LC_COLLATE '#{POSTGRES_CONFIG[:collate]}' LC_CTYPE '#{POSTGRES_CONFIG[:collate]}';
5454
SQL
5555

56-
params = { '-U' => ENV['PSQL_USER'] || 'postgres' }
56+
params = { '-U' => ENV['PSQL_USER'] || 'jruby' }
5757
params['-q'] = nil unless $VERBOSE
5858

5959
puts "Creating PostgreSQL (test) database: #{POSTGRES_CONFIG[:database]}"

test/db/postgresql/rake_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ def psql(args)
115115
end
116116

117117
# Use the test database user or fallback to ENV
118-
username = db_config[:username] || ENV['PSQL_USERNAME'] || 'postgres'
118+
username = db_config[:username] || ENV['PSQL_USERNAME'] || 'jruby'
119119
args = "--username=#{username} #{args}"
120120

121121
puts "psql args: #{args}"
122122

123123
# Set PGPASSWORD for authentication
124124
env = {}
125-
env['PGPASSWORD'] = db_config[:password] || 'postgres'
125+
env['PGPASSWORD'] = db_config[:password] || 'jruby'
126126

127127
IO.popen(env, "#{PSQL_EXE} #{args}") { |io| io.read }
128128
end

test/shared_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ module PostgresHelper
2525
class << self
2626
def postgres_role?(warn = nil)
2727
if psql = which('psql')
28-
if `#{psql} -c '\\l' -U postgres #{psql_params}2>&1` && $?.exitstatus == 0
28+
if `#{psql} -c '\\l' -U jruby #{psql_params}2>&1` && $?.exitstatus == 0
2929
true
3030
else
3131
if warn.nil?
32-
warn = "No \"postgres\" role ? Make sure service postgresql is running, "
33-
warn << "than you might need to execute `createuser postgres -drs' first."
32+
warn = "No \"jruby\" role ? Make sure service postgresql is running, "
33+
warn << "than you might need to execute `createuser jruby -drs' first."
3434
end
3535
send(:warn, warn) if warn # warn == false disables warnings
3636
false

0 commit comments

Comments
 (0)