nicolas-fricke / transfair

[DEPRECATED] Second, Rails-based approach to a web application for the Transfair-Project
https://www.transfair.co
3 stars 3 forks source link

fix typo of table-name in last migration #41

Closed spaudanjo closed 12 years ago

spaudanjo commented 12 years ago

just cloned the repo and tried to set it up locally, but the last migration failed ;-) was just a singular/plural typo.

migration: 20120819104219_drop_countries_transcription_information_table.rb

sdlp commented 12 years ago

Thanks @spaudanjo! @markus-hinsche, @nicolas-fricke , did you see this?

tiredpixel commented 12 years ago

A word of advice, if I may; this tends to be bad practice, and to cause all sorts of heartache for developers. :) If you notice a mistake in a migration, in 99% of cases it's much better to make a new migration, correcting the previous one. Clearly, you don't need to do this if the code's not yet been pushed. As soon as the code's public, it's best to assume that it's already been run (indeed, it is possible that an automatic testing server has picked up the changes and migrated - you probably don't have anything like that set up, but it's good to keep it in mind), and write a new migration to put things right. :) By all means, notify anyone who might be interested of affected - but this way, there's no need to keep track of whether a particular correction has been applied (which normally has to be done by hand).

The schema, however, is a beautiful thing in Rails; it is designed so it can be run at any time to load a new database schema. So, migrations for current databases, the schema for a new install (using something like rake db:schema:load, normally).

Hope this helps. :)

tiredpixel commented 12 years ago

Unless, of course, I've entirely misunderstood your commit, and somehow the correct table-name has already been run by all developers, but somehow the table name in the migration is wrong. (Which would be surprising, but stranger things have happened! ;) ) In which case, my above comments would of course no longer be applicable. :)

@tiredpixel :)

markus-hinsche commented 12 years ago

Sorry for the delayed response. I didn't clean my database correctly (rake db:setup does not what I expected it to), so I had a table to much which you normally do not have. The last migration is therefore crap so I deleted it... whould have been better do delete it via a new migration? Thx for the advice:)

tiredpixel commented 12 years ago

Ah, that makes more sense; thanks for explaining. :) If other developers had run it, then yes, a new migration would have been better, in most cases. If the problem were only existing on your own database, though, and everyone else's were fine, then there would indeed be no need for any changes at all.