Skip to content

Commit

Permalink
add README to migration
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Aug 31, 2024
1 parent d159697 commit a89df2f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc
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.

0 comments on commit a89df2f

Please sign in to comment.