Multiple databases in RoR: Issue with migration applied to the wrong database

Viewed 110

I want to add a secondary database to my RoR project, so I followed this: https://guides.rubyonrails.org/active_record_multiple_databases.html

So now I have two databases: jobtitleio & profiles

My issue is that when I run: rails db:migrate:profiles, the migration is applied to the other database (the primary one). => in this example, I want to add a table, and the table is added to the jobtitleio database.

Here is my database.yml:

development:
  jobtitleio:
    <<: *default
    database: jobtitleio_development
  profiles:
    <<: *default
    database: profiles_development
    migrations_paths: db/profiles/migrate

I ran this to create the migration: rails g migration CreateUsers url:text external_id:integer --database profiles which created the migration file in the right folder (db/profiles/migrate).

So this is where I'm at, my migration is created in the right folder, and is ran to be applied to the profiles database (using rails db:migrate:profiles). So why is it applied to the other database ?

Thanks for your help !

0 Answers
Related