-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk7TvjgACgkQW6QSU1GdvaxyOwCgpoLBWi6ur4u3LFFgTywECsrv
zxwAoJPDXT85y5DIzabXOhMIde+2kWFU
=bxAE
-----END PGP SIGNATURE-----
Am 28.11.2011 17:40, schrieb Sebastian:
> Is there no way I can simply assign imei to phone.id during create?
> That would make my life easier.
Only when wiping the database and creating the phone-table withoud id,
then creating the row id by hand as type integer.
Following would probably work:
0) DATABASE BACKUP!!!
1) Create a new temporary table, exactly as the phone-table is now.
2) Copy every single phone into that new table
3) drop old phone table
4) create a new table for your phones, make sure you create it with the
:id => false option, then t.integer :id in the migration itself.
Probably you will need another bigger version of int!
5) Update references! (You can find out the id <=> imei still in
temporary table)
6) Drop temporary table
7) create an index over your id-column
This could work all in one migration... NO you have to do this in one
migration just to be sure no one does anything in that time. If you do
that on the liveserver later, I strongly encourage you to stop the
service until the migration is run.
Be sure to test it locally in every single workcase! Even that usecases
that should not be possible!
You cant revert the changes easily!
HTH
Norbert
No comments:
Post a Comment