I found the answer for my own problem. Its rather simple. There is an option called search_path which ca be used in the database.yml file. It act as a search_path for schema. We can also append it to the url as query parameter - postgres//user:p...@host/db?search_path=. I did not find any reference to these option in the documentation though. However, was able to trace it out in the code.
Regards Bhavin On Jul 6, 5:44 pm, Bhavin <[email protected]> wrote: > Hi, > > In one of my multi tenant application, we need to use multiple > Postgresql schema. We love datamapper. Its much cleaner way to talk to > database. However, I believe currently postgresql adapter does not > support schema out of the box. I saw a patch by Sam that allows me to > use schema by specifying that in model's storage_name and overriding > quote_name method of AbstractAdapter. However, that approach dont > serve our purpose as in our case, same model/table exist in mutliple > schema (based on the tenant) + specifying schema name in every model > does not look very DRY. > > Ideally, it will be great to supply schema_name as an additional > option to the repository (like schema_search_path in active_record > postgresql adapter). Are there plans to build this support out of the > box. > > I am currently exploring making changes through > resource_naming_convention. However, I see some SQL statements in the > log where 'public' schema is present. If anyone can suggest a better > approach I can work on the patch. > > Thanks for making such an elegant orm. > > Regards > Bhavin -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
