Closed jpbalarini closed 10 months ago
@jpbalarini did you find a solution for this?
Nope, I had to disable the migrations are pending error with:
config.active_record.migration_error = false
which isn't a good practice.
FYI. To get migrations done correctly on the master, with a correct schema dump, I had to disable the replica before the migration, and re-enable it after.
Would be good if Octopus just migrated master only by default, or had a switch to enable this.
Same issue here.
I'm having a problem with pending migrations on my master database. I get the
Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.
error.Some background about what I want. I have millions of records on the Employees and Companies tables that I want to move to sharded databases. My idea is to separate records from those 2 tables to sharded tables but divided by country. In the master database, I still want to have every Employee and Company (not divided by country). So, for example, if I have and Employee from Uruguay and another one from Brazil I would like to have the Uruguayan one on the master database (specified by database.yml) and in the Uruguayan shard. For the Brazilian one, it would go to the master database and to the Brazilian shard.
This is my
shards.yml
:and this is my
database.yml
:For achieving this, I had to create 2 migrations for the Employees table and 2 for the Companies. For example for Employees my migrations are like:
The problem is that migrations that run in the group
country_shards
are not added to the schema_migrations table for the master database. So when I run the server I get theMigrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.
error.If I do a:
I can see that indeed are not in the database:
Is this a bug? Why is this happening? Thanks in advance!