Skip to content

Commit c98b443

Browse files
committed
docs: add ADR for database migration squash strategy
1 parent 056f03f commit c98b443

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
slug: 9
3+
title: |
4+
9. Database migration squashing
5+
authors:
6+
- name: Mithril Team
7+
tags: [Accepted]
8+
date: 2025-03-13
9+
---
10+
11+
## Status
12+
13+
Accepted
14+
15+
## Context
16+
17+
Many database migrations have accumulated over time for the Mithril nodes. As the migrations are done sequentially, the resulting scheme of the database is hard to understand and maintain.
18+
19+
## Decision
20+
21+
To mitigate these concerns, we have decided to implement a migration squashing once we have stacked too many migrations for a store: all the existing migrations are consolidated and replaced by the equivalent new migration.
22+
23+
## Consequences
24+
25+
- This applies to the migrations of all the stores of the Mithril nodes
26+
- A squashed migration will be applied when a database is initialized for the first time
27+
- A squashed migration must be optional and run only if not already applied previously with the equivalent migration sequence
28+
- Some nodes may have only partially applied the equivalent sequence of migrations and thus can not apply the squashed migration right away:
29+
- They need to first run the migration with the latest distribution that does not ship the squashed migration so that their database is ready to play the squashed migration
30+
- This distribution is associated to a squashed migration to provide a smooth user experience.

0 commit comments

Comments
 (0)