diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb | 17 | ||||
-rw-r--r-- | db/structure.sql | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb b/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb new file mode 100644 index 00000000000..e4a0ec1eb4a --- /dev/null +++ b/db/post_migrate/20200420162730_remove_additional_application_settings_rows.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveAdditionalApplicationSettingsRows < ActiveRecord::Migration[6.0] + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + end + + def up + return if ApplicationSetting.count == 1 + + execute "DELETE from application_settings WHERE id NOT IN (SELECT MAX(id) FROM application_settings);" + end + + def down + # no changes + end +end diff --git a/db/structure.sql b/db/structure.sql index 96211531462..01c4f8fefa1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13421,6 +13421,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200416120128 20200416120354 20200417044453 +20200420162730 20200420172113 20200420172752 20200420172927 |