Migrate Existing Data

Finally, we need to account for the new association to OtherModel that was added. We need calls to OldModel.old_field_3 to act exactly the same as NewModel.other_model.other_field_1. For this, we use a

combination of alias and delegate:

As shown in the diagram above, we converted a single database table into two tables, and spread the columns between the two. The concept was simple enough: Iterate over all the rows in the old table and create entries in the new tables based on the existing data, ensuring the new association exists. We also wanted to make sure the IDs in the new tables matched the old IDs, because we have some external tools and reports that rely on that ID. Here’s a naive first attempt:

 

OldModel.find_in_batches do |batch|

 

 

 

Use Mobile-Friendly Checkout
The checkout process is a critical part of the customer journey, so it’s important to make sure your checkout process is mobile-friendly. Simplifying the process as much as possible, allowing users to checkout as guests, and enabling quick payment options such as Apple Pay or Google Wallet can help create a seamless checkout experience for mobile users. Most ecommerce software programs will allow you to integrate this in for your ecommerce store. Additionally, it’s important to keep in mind that mobile users may be using different payment methods than desktop users, so make sure your checkout process is flexible enough to accommodate different payment options.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top