You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mesa-upgrade/appendix.mdx
+42-15Lines changed: 42 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,30 +13,57 @@ keywords:
13
13
14
14
## Upgrading archive nodes from Berkeley to Mesa
15
15
16
-
Below we presents details what was changed in the archive node database schema between Berkeley and Mesa version.
16
+
Below we present details of what changed in the archive node database schema between Berkeley and Mesa versions.
17
17
18
-
**Zkapp_state_nullable additional Columns **
19
-
- The `zkapp_state_nullable` table has been modified to include a new columns `element8` to `element31` which are nullable and can store additional state information for zkApps.
18
+
### Extended zkApp State Fields
19
+
20
+
**zkapp_states_nullable table**
21
+
- Added columns `element8` through `element31` (nullable integer fields)
22
+
- Each new column references `zkapp_field(id)`
23
+
- These fields allow zkApps to store additional state information beyond the original 8 elements
20
24
21
25
```sql
22
-
, element8 intREFERENCES zkapp_field(id)
26
+
ALTERTABLE zkapp_states_nullable ADD COLUMN IF NOT EXISTS element8 INTREFERENCES zkapp_field(id);
23
27
...
24
-
, element31 intREFERENCES zkapp_field(id)
25
-
);
28
+
ALTERTABLE zkapp_states_nullable ADD COLUMN IF NOT EXISTS element31 INTREFERENCES zkapp_field(id);
29
+
```
26
30
31
+
**zkapp_states table**
32
+
- Added columns `element8` through `element31` (non-nullable integer fields)
33
+
- Each new column references `zkapp_field(id)` with a default value pointing to the zero field
34
+
- Unlike the nullable version, these fields are required and default to the zero field ID
35
+
36
+
```sql
37
+
ALTERTABLE zkapp_states ADD COLUMN IF NOT EXISTS element8 INT DEFAULT <zero_field_id>NOT NULLREFERENCES zkapp_field(id);
38
+
...
39
+
ALTERTABLE zkapp_states ADD COLUMN IF NOT EXISTS element31 INT DEFAULT <zero_field_id>NOT NULLREFERENCES zkapp_field(id);
27
40
```
28
41
29
-
**Version table**
42
+
### Migration History Tracking
30
43
31
-
We also introduced a new table `version` to keep track of the database schema version.
32
-
Purpose of this table is to help with future database migrations. Table tracks which migration scripts were applied and when.
33
-
Ultimately it helps to determine the current version of the database schema. And helps to avoid applying the same migration script multiple times.
44
+
The upgrade introduces a new `migration_history` table to track database schema migrations. This helps manage future upgrades and prevents applying the same migration multiple times.
34
45
35
-
This table is created if it does not exist already. Rollback and upgrade scripts will insert a new row with the version number and timestamp when the script was applied.
-**commit_start_at**: Timestamp when the migration started
64
+
-**protocol_version**: Target protocol version (e.g., '4.0.0' for Mesa)
65
+
-**migration_version**: Version of the migration script itself (e.g., '0.0.5')
66
+
-**description**: Human-readable description of the migration
67
+
-**status**: Current state of the migration (starting, applied, or failed)
68
+
69
+
The migration script uses protocol version '3.0.0' for Berkeley and '4.0.0' for Mesa, with built-in safety checks to prevent reapplying migrations or running them on incorrect database versions.
Copy file name to clipboardExpand all lines: docs/mesa-upgrade/upgrade-steps.mdx
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,8 +100,6 @@ There will be both Docker images and archive node releases available to choose f
100
100
- Operators shall import the SQL dump file provided by o1Labs to a freshly created database.
101
101
- Operators should direct their Mesa archive process to the newly created database.
102
102
103
-
**Please note:** both the _trustless_ and _trustful_ migration processes will discard all Mainnet blocks that are not canonical. If you wish to preserve the entire block history, i.e. including non-canonical blocks, you should maintain the Mainnet archive node database for posterior querying needs.
104
-
105
103
### Exchanges
106
104
1. Exchanges shall disable MINA deposits and withdrawals during the entirety of the upgrade downtime, since the _stop-transaction-slot_ until the Mainnet Mesa network is operational.
107
105
2. After the Mesa releases are published, exchanges should upgrade their nodes and prepare for the new network to start block production.
0 commit comments