From 7b9f541dec62d34c5ae6416c28ebd36271d46870 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Sat, 31 Aug 2024 09:03:38 -0700 Subject: [PATCH] add README to migration --- .../README.adoc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc diff --git a/schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc b/schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc new file mode 100644 index 00000000000..ce6b6e5429b --- /dev/null +++ b/schema/crdb/turn-boot-on-fault-into-auto-restart/README.adoc @@ -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.