-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
= Overview | ||
|
||
This migration replaces the `omicron.public.instance.boot_on_fault` column, | ||
which is a `bool`, with a new `auto_restart_policy` column, which is an enum | ||
(`omicron.public.instance_auto_restart`). The new enum type will allow | ||
auto-restart policies other than "always" and "never" to be added in the future. | ||
Existing instance records are backfilled with the `all_failures` variant of | ||
`instance_auto_restart` if `boot_on_fault` is `true`, or `never` if | ||
`boot_on_fault` is `false`. | ||
|
||
The migration performs the following operations: | ||
|
||
1. `up01.sql` creates the `instance_auto_restart` enum. | ||
2. `up02.sql` adds a (nullable) `auto_restart_policy` column to the `instance` | ||
table. | ||
3. `up03.sql` updates instance records by setting `auto_restart_policy` to | ||
`all_failures` if `boot_on_fault` is `true`, or `never` if `boot_on_fault` is | ||
`false`. | ||
4. Now that all instance records have a value for `auto_restart_policy`, | ||
`up04.sql` makes the `auto_restart_policy` column non-null. | ||
5. Finally, `up05.sql` drops the now-defunct `boot_on_fault` column. |