1

I want to have two schemas(except public) in a pgsql database on heroku. On local I have done it like imported the data to public schema and renamed it to the name of my choice. In the similar manner i created two schema under one DB and connected it to a rails application using

search_schema_path: 'schema1, schema2'

Now I want to do the same on heroku and tried the same procedure. But it seems that, rails can not find tables from the DB. I am getting the error relationship "delayed_jobs" does not exists. Please suggest me how to do it.

Thanks in advance for any help.

1 Answer 1

2

When your Rails app is deployed on Heroku, an automatically generated database.yml over-writes your applications database.yml, which is dropping your schema_search_path setting, reseting it to public.

You can add an initializer that reset the value after load. For example, config/initializers/postgres_schema.rb:

ActiveRecord::Base.connection.schema_search_path = 'schema1, schema2'

You'll need to be careful to set this anywhere you're re-connecting or re-setting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.