Blankman
Blankman

Reputation: 266910

Rails 4 and postgresql schemas, how to run migrations for 2 schemas

Say I have a User model, and I want to setup postgresql with 2 schemas:

test1.users
test2.users

Is there a way to specify the schema I want to use when running migrations?

rake db:migrate schema=test1

Upvotes: 0

Views: 1392

Answers (1)

user229044
user229044

Reputation: 239230

Add an environment, call it "test2", and define your schema in config/database.yml. Then run your migration with RAILS_ENV=test2 rake db:migrate.

Upvotes: 2

Related Questions