I'm trying to migrate my old php website database (mysql) to a rails 3 app (mysql) by a rake legacy script like this:
How to migrate legacy PHP mysql data to new Rails data model?
but i have a problem:
- old table id's were lost because if i have a table with
id | field
1 | field_value
2 | field_value 2
4 | field_value 4
Using Model.create(....) it becomes:
id | field
1 | field_value
2 | field_value 2
3 | field_value 4
how can i migrate using Model.create(....) and mantaining old id's?
Have a look here: Overriding id on create in ActiveRecord
Also, consider just dumping and importing the whole database. You can make rails specific modifications to the data later with migrations.