From 36581ab5b7217eff698d6e8d0ee13d1acecc572c Mon Sep 17 00:00:00 2001 From: Tim Campbell Date: Thu, 6 Mar 2025 11:02:43 +0100 Subject: [PATCH] Fix migrations running even when hook is disabled (#173) --- templates/job-db-migrate.yaml | 2 ++ templates/job-db-pre-migrate.yaml | 2 ++ templates/job-db-prepare.yaml | 2 +- values.yaml | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/job-db-migrate.yaml b/templates/job-db-migrate.yaml index da7503a..748420c 100644 --- a/templates/job-db-migrate.yaml +++ b/templates/job-db-migrate.yaml @@ -1 +1,3 @@ +{{- if .Values.mastodon.hooks.dbMigrate.enabled }} {{- include "mastodon.dbMigrateJob" (merge (dict "preDeploy" false ) .) }} +{{- end }} diff --git a/templates/job-db-pre-migrate.yaml b/templates/job-db-pre-migrate.yaml index 2f29716..bae1717 100644 --- a/templates/job-db-pre-migrate.yaml +++ b/templates/job-db-pre-migrate.yaml @@ -1 +1,3 @@ +{{- if .Values.mastodon.hooks.dbMigrate.enabled }} {{- include "mastodon.dbMigrateJob" (merge (dict "preDeploy" true ) .) }} +{{- end }} diff --git a/templates/job-db-prepare.yaml b/templates/job-db-prepare.yaml index 5e9a6a2..1959cd5 100644 --- a/templates/job-db-prepare.yaml +++ b/templates/job-db-prepare.yaml @@ -1,3 +1,3 @@ -{{- if not .Values.postgresql.enabled }} +{{- if and .Values.mastodon.hooks.dbMigrate.enabled (not .Values.postgresql.enabled) }} {{- include "mastodon.dbMigrateJob" (merge (dict "prepare" true ) .) }} {{- end }} diff --git a/values.yaml b/values.yaml index 93d4d9e..837dae9 100644 --- a/values.yaml +++ b/values.yaml @@ -24,7 +24,7 @@ mastodon: # @ignored email: not@example.com hooks: - # Whether to perform DB migrations on `helm install|upgrade`. + # Whether to perform DB preparations & migrations on `helm install|upgrade`. # Please note that initial DB schema creation on `helm install` does not # work when using the included database (postgresql.enabled=true). dbMigrate: