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

  1. in current branch, run rake db:rollback step=n rollback schema change done current branch
  2. then checkout co old branch execute rake db:rollback step=m rollback schema change old branch.
  3. checkout current branch, , run rake db:migrate, , not see changes in schema file.

reference:


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -