Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrock-adam committed Jan 14, 2024
1 parent 961545b commit a85ca25
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
run: |
sudo apt-get -qq install -y postgresql-client
export PGPASSWORD=outboxer_password
psql -h localhost -U outboxer_tester -d outboxer_test -c 'SELECT version();'
psql -h localhost -U outboxer_tester -d outboxer_test -c 'SELECT version();
# - name: Create Database
# run: RAILS_ENV=test bin/rake outboxer:db:create -f spec/tasks/database.rake
- name: Run Database Migrations
run: RAILS_ENV=test bin/rake outboxer:db:migrate -f spec/tasks/database.rake
- name: Run the default task
run: bundle exec rake
File renamed without changes.
19 changes: 11 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@
# 'database' => 'outboxer_test'
# }

db_config = {
'adapter' => 'postgresql',
'username' => 'outboxer_tester',
'password' => 'outboxer_password',
'database' => 'outboxer_test',
'host' => 'localhost',
'port' => 5432
}
# db_config = {
# 'adapter' => 'postgresql',
# 'username' => 'outboxer_tester',
# 'password' => 'outboxer_password',
# 'database' => 'outboxer_test',
# 'host' => 'localhost',
# 'port' => 5432
# }

db_config_path = File.expand_path('config/database.yml', Dir.pwd)
db_config = YAML.load_file(db_config_path)[env]

Outboxer::Publisher.connect!(db_config: db_config)

Expand Down
15 changes: 6 additions & 9 deletions spec/tasks/database.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ namespace :outboxer do
ActiveRecord::Base.establish_connection({
'adapter' => 'postgresql', 'username' => `whoami`.strip, 'database' => 'postgres' })

db_config_path = File.expand_path('../config/database.yml', __dir__)
db_config = YAML.load_file(db_config_path)[ENV.fetch('RAILS_ENV')]

ActiveRecord::Base.connection.drop_database(db_config['database'])

ActiveRecord::Base.connection.disconnect!
Expand All @@ -21,7 +18,7 @@ namespace :outboxer do
ActiveRecord::Base.establish_connection({
'adapter' => 'postgresql', 'username' => `whoami`.strip, 'database' => 'postgres' })

db_config_path = File.expand_path('../config/database.yml', __dir__)
db_config_path = File.expand_path('config/database.yml', Dir.pwd)
db_config = YAML.load_file(db_config_path)[ENV.fetch('RAILS_ENV')]

ActiveRecord::Base.connection.create_database(db_config['database'])
Expand All @@ -30,7 +27,7 @@ namespace :outboxer do
end

task :migrate do
db_config_path = File.expand_path('../config/database.yml', __dir__)
db_config_path = File.expand_path('config/database.yml', Dir.pwd)
db_config = YAML.load_file(db_config_path)[ENV.fetch('RAILS_ENV')]
ActiveRecord::Base.establish_connection(db_config)

Expand All @@ -40,11 +37,11 @@ namespace :outboxer do
require_relative "../../generators/outboxer/templates/migrations/create_outboxer_exceptions"
CreateOutboxerExceptions.new.up

require_relative "../db/migrate/create_accounting_invoices"
CreateAccountingInvoices.new.up
# require_relative "../db/migrate/create_accounting_invoices"
# CreateAccountingInvoices.new.up

require_relative "../db/migrate/create_events"
CreateEvents.new.up
# require_relative "../db/migrate/create_events"
# CreateEvents.new.up

ActiveRecord::Base.connection.disconnect!
end
Expand Down

0 comments on commit a85ca25

Please sign in to comment.