I have a Ruby on Rails application that has two active environments, Stage
and Production
. Our development team has been using Stage
, but we would like to move our data onto the production server for various reasons. However, there are conflicting ID's in the new database, so it's not as simple as pulling the data from one location and inserting it into another. For example, say we have a table called Widgets:
Widget:
id: 9836
name: "Staging widget"
parent_id: 9635
container_id: 533
If the above data is one of our widgets, we can't do the import because there is already a widget with ID 9836
and/or there is already a container with the ID 533
, meaning we would need to crawl the association chain to construct new containers before putting widgets in them.
We are using MySQL databases for both environments. I thought about doing the import, and just adding 10,000 to all the appropriate columns that end in _id
, as it would push us beyond the conflicting boundaries, but that seems like a bad solution.
Are there any tools, projects, or ideas that may help me solve this problem?