First a disclaimer: I’m no expert on using PostgreSQL w/rails. So, take this with a grain of salt. Hopefully someone w/more knowledge will respond.
Does Rails 3 support native working with postgresql schemas, or I
should try some own solution?
As you’ve discovered it has some but obviously isn’t complete.
I have some already-created postgresql database with 4 or somth
schemas.
By putting “schema_search_path: ejabber, public, admin, statistic”
into database.yml I told Rails that I have more than 1 schema.
When I make “rake db:schema:dump” I have tables from all 4 schemas
alphabetical with no schema-dependency.
This, however, would definitely seem to be a problem to me. Perhaps you could report it as a bug?
So the question is, when I’ll be ready to deploy my app on production
(via capistrano, for example), is there would be still 4 schemas in
database, or only one? How does Rails keeps knowing which table
belongs to which schema?
This depends. You say you’ve already got a database. By this, do you mean you’ve already got a “development” database but that you’d be instantiating a new one for production? Or, is your existing database a production database?
If it’s production, then the fact that the schema-dumping code drops postresql schema information won’t be a problem because you won’t be using this dumped schema information to create a production database. I think (grain of salt) it would just work since (hopefully) the postgres adapter will otherwise work fine when “addressing” your tables in the constructed SQL queries.
However, if you’re dumping schema from an existing “development” database so that you can use it to create a production database, then you’ll have problems (unless, of course, you have no table name collisions in which case it might just create all tables in the “public” schema and work, even if not in the configuration (multi-schema) you want).