Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/setup broken (as of rails 7.1.3.2) #4373

Closed
1 task
cielf opened this issue May 21, 2024 · 3 comments · Fixed by #4376
Closed
1 task

bin/setup broken (as of rails 7.1.3.2) #4373

cielf opened this issue May 21, 2024 · 3 comments · Fixed by #4376
Assignees

Comments

@cielf
Copy link
Collaborator

cielf commented May 21, 2024

Summary

When running bin/setup on the current main, it breaks when attempting to drop the databasse.

Things to consider

Here are the details:
undefined local variable or method establish_master_connection’ for #<ActiveRecord::Tasks::PostgreSQLDatabaseTasks:0x000000011e9e2450 @db_config=#<ActiveRecord::DatabaseConfigurations::HashConfig:0x000000011d9028b0 @env_name=“development”, @name=“primary”, @configuration_hash={:adapter=>“postgresql”, :encoding=>“unicode”, :host=>nil, :database=>“diaper_dev”, :username=>nil, :password=>nil, :pool=>5, :timeout=>5000}>, @configuration_hash={:adapter=>“postgresql”, :encoding=>“unicode”, :host=>nil, :database=>“diaper_dev”, :username=>nil, :password=>nil, :pool=>5, :timeout=>5000}> Couldn’t drop database ‘diaper_dev’ bin/rails aborted! NameError: undefined local variable or method establish_master_connection’ for #<ActiveRecord::Tasks::PostgreSQLDatabaseTasks:0x000000011e9e2450 @db_config=#<ActiveRecord::DatabaseConfigurations::HashConfig:0x000000011d9028b0 @env_name=“development”, @name=“primary”, @configuration_hash={:adapter=>“postgresql”, :encoding=>“unicode”, :host=>nil, :database=>“diaper_dev”, :username=>nil, :password=>nil, :pool=>5, :timeout=>5000}>, @configuration_hash={:adapter=>“postgresql”, :encoding=>“unicode”, :host=>nil, :database=>“diaper_dev”, :username=>nil, :password=>nil, :pool=>5, :timeout=>5000}> (NameError)
establish_master_connection
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Did you mean? establish_connection
/Users/clfisher/projects/human-essentials/config/initializers/postgres.rb:7:in `drop’
Tasks: TOP => db:drop:_unsafe
(See full trace by running task with --trace)
== Command [“bin/rails db:reset”] failed ==“(edited)

IIUC , we are overriding ActiveRecord::Tasks::PostgreSQLDatabaseTasks.drop in config/initializers/postgres.rb in development and test.
Our override calls establish_master_connection.
This https://apidock.com/rails/v7.1.3.2/ActiveRecord/Tasks/PostgreSQLDatabaseTasks seems to suggest that establish_master_connection is no longer a thing. It lists a newish method: establish_connection which one might surmise is a replacement.

Criteria for Completion

  • bin/setup works again!
@elasticspoon
Copy link
Collaborator

I think that initializer can probably be dropped. Based on 87db6df the commit that added it, it seems like it was meant to be used with pow.cx.

I have no clue what that is. But based on the website being dead http://get.pow.cx/ I'm assuming that project is no longer being worked on.

@cielf
Copy link
Collaborator Author

cielf commented May 21, 2024

FYI Apparently it is/was "A zero-config Rack server for Mac OS X. It is a self-contained server that runs as a user without root privileges."
The reposotiry for it (basecamp/pow) was archived in 2020. (https://github.com/basecamp/pow)

I too, expect we've moved on, and that this overriding could be yanked.

@elasticspoon
Copy link
Collaborator

#4376 i think that will do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants