-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rake db:migrate should run only on master (shouldn't try to run on slaves) #353
Comments
Does the comment from velles here #345 work for you? |
@anhkind No, this method adds the master shard at the end of the shards list. So, Octopus is trying in that order: slave1, slave2, slave3, master. |
Can you paste the content of the migration file that failed the migration here? |
# migration file example
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :first_name, null: false, limit: 40
t.string :last_name, null: false, limit: 40
t.string :email, null: false, limit: 100
t.string :password_digest, null: false
t.string :picture, limit: 50
t.string :cid, limit: 20
t.string :cell_phone, limit: 20
t.string :address, limit: 250
t.string :utype, null: false, limit: 20
t.integer :institution_id, null: false
t.integer :city_id, null: false
t.integer :gender, null: false, limit: 1, default: 0
t.integer :blood_group, null: false, limit: 1, default: 0
t.integer :status, null: false, limit: 1, default: 0
t.date :birth_date
t.timestamps null: false
end
add_index :users, :institution_id
add_index :users, :utype
add_index :users, :email, unique: true
end
end All files like this. They only create the table.I didn't make any changes on migration files for the Octopus. |
Are you running version 0.8.5 or from github's master branch? Can you try the master branch to see if it helps? |
Didn't work for me with master's code |
Same issue here |
I think I'm having a related issue where I run I'm running postgres and Octopus 0.9.0. The error output from Here is the slimmed-down output:
|
@ecylmz and @francois-tilkee, did you eve figure out a solution here? |
@ryanwjackson Nope... I still have to scroll my terminal up for 20 seconds to see what happened in my migration. |
So, I actually figured out mine. It was an issue with how the migrations were being loaded by Octopus. We had added some inflections, which meant that those classes couldn't be loaded properly. Normal rails migrations apparently doesn't attempt to load in the same way, but Octopus does. So renaming the classes properly worked. That said, are you doing replication or sharding? |
Replication |
Hi, |
see #345 (comment) |
I have fully replicated MySQL Master-Slave databases. I just want to run
rake db:migrate
command on master shard.If
Octopus
try to runrake db:migrate
command onslaves
, MySQL Slaves stop working.My migration files and models not include any
using(:shard)
blocks.I just want to send all write queries and migration commands to master, and all reads queries to slaves. MySQL is handling replication job.
Detailed information are listed below.
Problem steps:
rake db:migrate RAILS_ENV=development
Example MySQL Error:
As a result, I just want to run
rake db:migrate
command on master shard. What am i missing?@sobrinho: Can you help me? :(
The text was updated successfully, but these errors were encountered: