My Rails app is migrating to a new date structure, and there are some migrations have to be run together.
First, There is a MyModel.find_by(name: 'NAME').update quantity: 1 execution in previous migration.
Then, i add state_machine to this model (MyModel) and set up an initialization: state_machine initial: :active . Then i run all the new migrations, and it raise there is no state column error.
yes, there is no state column while running previous migration.
I think it should not touch the state when model is updating others column no matter there is a state or not.
PS. at least, i have to use execute DSL in migration.
My Rails app is migrating to a new date structure, and there are some migrations have to be run together.
First, There is a
MyModel.find_by(name: 'NAME').update quantity: 1
execution in previous migration. Then, i add state_machine to this model (MyModel) and set up an initialization:state_machine initial: :active
. Then i run all the new migrations, and it raise there is nostate
column error.yes, there is no
state
column while running previous migration. I think it should not touch the state when model is updating others column no matter there is astate
or not.PS. at least, i have to use
execute
DSL in migration.