Skip to content

Don't assume default client search path#1

Open
chewi wants to merge 3 commits intorazum2um:masterfrom
yakara-ltd:master
Open

Don't assume default client search path#1
chewi wants to merge 3 commits intorazum2um:masterfrom
yakara-ltd:master

Conversation

@chewi
Copy link
Copy Markdown

@chewi chewi commented Oct 25, 2013

Since ActiveRecord 3.2.14, db/structure.sql automatically includes a "SET search_path TO" statement before adding the "INSERT INTO schema_migrations" statements, which is handy.

However, if you haven't set schema_search_path in your config/database.yml (I deliberately haven't) and you use multi_schema in your migrations then the search path will flip-flop between "$user",public and public depending on whether you've run "rake db:structure:dump" or "rake db:migrate". This makes version control tedious.

The default client search path of "$user",public can be overridden in postgresql.conf so I have made this configurable through MultiSchema.default_search_path as part of this fix.

chewi and others added 3 commits October 25, 2013 13:15
Since ActiveRecord 3.2.14, db/structure.sql automatically includes a "SET search_path TO" statement before adding the "INSERT INTO schema_migrations" statements, which is handy.

However, if you haven't set schema_search_path in your config/database.yml (I deliberately haven't) and you use multi_schema in your migrations then the search path will flip-flop between "$user",public and public depending on whether you've run "rake db:structure:dump" or "rake db:migrate". This makes version control tedious.

The default client search path of "$user",public can be overridden in postgresql.conf so I have made this configurable through MultiSchema.default_search_path as part of this fix.
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 this pull request may close these issues.

2 participants