ruby on rails - Unintended Schema changes every time I commit -
every time commit code has migration, reason, bunch of schema changes didn't write, came previous prs.
for example, i'll write migration add column on user...but after running migration, schema file include 10 changes previous old code isn't in current branch @ all.
how fix this?
the schema file reflect database schema. think had changed schema @ previous old code didn't recover(rollback) it, deleted , start coding new migration.
the thing shloud eliminating diff between code , datebase.
solution:
checkout old branch , rollback schema change runningrake db:migrate:down version=20161106xxxxxx
.
or
- in current branch, run
rake db:rollback step=n
rollback schema change done current branch - then checkout co old branch execute
rake db:rollback step=m
rollback schema change old branch. - checkout current branch, , run
rake db:migrate
, , not see changes in schema file.
reference:
Comments
Post a Comment