On Tuesday 28 September 2010, Fritz T. wrote:
To prevent this, I locally removed the data migrations on the new
server before migrating.
On my developmentsystem, they’re still present and dont harm, but I
guess, they will be pushed up to the server again with my next update
and will get run, because there is no corresponding entry in the
migration data base.
Why is there no corresponding entry in the database? If you initialize a
database from db/schema.rb, an entry is created in the migrations table
indicating the version of the schema.
Maybe, the simplest solution will be, to do something to make them
null migrations on the development system.
Just throw them away. If you can.
Migrations are tools for changing the structure of a database from one
version to the next. They have no lasting value. In particular,
migrations are not the right means to re-create a database. For that,
db/schema.rb + rake db:schema:load is the proper way.
Also, migrations are not supposed to add data to the database, apart
from changes necessary for migrating the structure. For adding data,
there are db/seeds.rb and rake db:seed. It’s good idea to write
db/seeds.rb in such a way that it can be run again and again without
causing harm.
In summary, if you’re worried that old migrations may inadvertently be
applied to your database, make sure that it contains a suitable entry in
its migrations table indicating the actual version of the schema.
Michael
–
Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/