DEV Community

Cover image for Tick Tock migration pattern
Sibelius Seraphini for Woovi

Posted on

11

Tick Tock migration pattern

Tick Tock is when you do a migration in two steps to avoid breaking.

Tick

Image description

Imagine we have 2 different models/collections/tables to store transactions (TransactionModel) and refund transactions (TransactionRefundModel)
However, you figure it out that this 2 models should be the same collection.
What is the best approach to convert all TransactionRefundModel to TransactionModel?

The best approach is to start writing the refund transaction for both old and new model.
After this is done, you can compare if you are not losing information in this migration.
Then, you write a migration to migrate the old data to the new data.

This is the Tick part of the migration. You have 2 models working together.

Tock

Image description

The Tock part is modifying the code to read from the new data only.
After the reading new data is done and correct.
You can stop writing data to the old data.
Do not forget to cleanup the old data and code.


Woovi is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are hiring!


Photo by Ethan M. on Unsplash

API Trace View

Struggling with slow API calls? đź•’

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more