This project is archived and is in readonly mode.
[PATCH] Create schema during 'rake db:create' from schema_search_path if it does not exist for PostgreSQL
Reported by Jim Gay | December 20th, 2008 @ 05:47 AM | in 3.0.2
Setting a non-existent schema name for the schema_search_path will cause errors when trying to migrate:
PGError: ERROR: schema "products" does not exist
: SET search_path TO products, public
http://github.com/saturnflyer/ra... (UPDATED commit) adds methods to the postgresql_adapter:
- create_schema(name, username) (creating the schema for the given user)
- all_schemas (returning an array of schema names)
- has_schema?(name) (returns boolean based on the existence of the given schema)
With this patch, the message "Schema products has been created." will be output when the schema is first created.
Comments and changes to this ticket
-
Jim Gay December 20th, 2008 @ 07:28 PM
Didn't realize where the tests needed to go. I'm working on them now... sorry for the early noise
-
Pratik March 8th, 2009 @ 02:38 PM
- State changed from new to incomplete
Could you please upload a patch using git-format-patch ? http://guides.rails.info/contrib... should help.
Thanks !
-
Pratik March 9th, 2009 @ 10:00 AM
- State changed from incomplete to open
-
Rizwan Reza March 26th, 2010 @ 01:46 PM
- State changed from open to verified
- Tag changed from 2.3, adapters, databases.rake, patch, postgresql, rake to 3.0, adapters, databases.rake, patch, postgresql, rake
- Assigned user changed from Tarmo Tänav to Pratik
- Title changed from Create schema during 'rake db:create' from schema_search_path if it does not exist for PostgreSQL to [PATCH] Create schema during 'rake db:create' from schema_search_path if it does not exist for PostgreSQL
- Milestone cleared.
This is exactly the same patch but applies cleanly on master.
-
Rizwan Reza March 28th, 2010 @ 08:15 AM
- State changed from verified to resolved
Done, committed here: http://github.com/rails/rails/commit/6c2a0675f11a9b5b8e88ed7dbccd65...
-
eagle.anton (at gmail) April 1st, 2010 @ 11:10 AM
- Assigned user changed from Pratik to Rizwan Reza
This commit breaks test database prepare by rake db:test:prepare.
Because query:SELECT schema_name FROM information_schema.schemata;
doesn't return any schema for non SUPERUSER and it tries to create it.
And how result we have error:PGError: ERROR: permission denied for database postgres : CREATE SCHEMA "public" AUTHORIZATION "user"
and not created test db.
-
Rizwan Reza April 5th, 2010 @ 03:47 PM
Don't you need to have authorization for 'postgres' database to create schemas?
-
eagle.anton (at gmail) April 6th, 2010 @ 12:37 PM
Ok. Let's talk about workflow with postgres.
There are my steps:
sudo -u postgres psql CREATE ROLE user_name with createdb login password 'pass';
-
Michael Koziarski April 9th, 2010 @ 12:14 AM
- State changed from resolved to open
eagle.anton is right, this breaks my ability to run tests,
the cure is worse than the disease here.
Also, why's it trying to create the public schema anyway?
-
Dan Pickett May 15th, 2010 @ 01:53 AM
- Tag changed from 3.0, adapters, databases.rake, patch, postgresql, rake to 3.0, adapters, bugmash, databases.rake, patch, postgresql, rake
-
Rizwan Reza June 8th, 2010 @ 04:39 PM
- State changed from open to stale
- Assigned user cleared.
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Medium
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>