From bc59b31ba881339e7e1180aa93986221001e4c0b Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Tue, 8 Jul 2025 14:29:36 +0200 Subject: [PATCH] be more failsafe when local db already has columns --- db/migrate/20240729103525_add_proxy_byos_mode_to_systems.rb | 4 ++-- db/migrate/20250121104357_add_regcode_to_systems.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/migrate/20240729103525_add_proxy_byos_mode_to_systems.rb b/db/migrate/20240729103525_add_proxy_byos_mode_to_systems.rb index c5aa1b9ed..79ec2e2db 100644 --- a/db/migrate/20240729103525_add_proxy_byos_mode_to_systems.rb +++ b/db/migrate/20240729103525_add_proxy_byos_mode_to_systems.rb @@ -1,10 +1,10 @@ class AddProxyByosModeToSystems < ActiveRecord::Migration[6.1] def up - add_column :systems, :proxy_byos_mode, :integer + add_column :systems, :proxy_byos_mode, :integer, if_exists: false change_column_default :systems, :proxy_byos_mode, 0 end def down - remove_column :systems, :proxy_byos_mode + remove_column :systems, :proxy_byos_mode, if_exists: true end end diff --git a/db/migrate/20250121104357_add_regcode_to_systems.rb b/db/migrate/20250121104357_add_regcode_to_systems.rb index 8461bbe51..4ca248b82 100644 --- a/db/migrate/20250121104357_add_regcode_to_systems.rb +++ b/db/migrate/20250121104357_add_regcode_to_systems.rb @@ -1,10 +1,10 @@ class AddRegcodeToSystems < ActiveRecord::Migration[6.1] def up - add_column :systems, :pubcloud_reg_code, :string + add_column :systems, :pubcloud_reg_code, :string, if_exists: false change_column_default :systems, :pubcloud_reg_code, nil end def down - remove_column :systems, :pubcloud_reg_code + remove_column :systems, :pubcloud_reg_code, if_exists: true end end