DEV: Delete old enable_bookmarks_with_reminders setting (#25982)

This setting has not been used for a long time, get rid
of it and also update the historical migration to not
rely on the SiteSetting model.
This commit is contained in:
Martin Brennan 2024-03-04 13:48:04 +10:00 committed by GitHub
parent 1a76c4e099
commit fef52c2ab7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 5 deletions

View File

@ -338,10 +338,6 @@ basic:
default: "14"
allow_any: false
refresh: true
enable_bookmarks_with_reminders:
client: true
default: true
hidden: true
push_notifications_prompt:
default: true
client: true

View File

@ -2,7 +2,20 @@
class CreateBookmarksFromPostActionBookmarks < ActiveRecord::Migration[6.0]
def up
SiteSetting.enable_bookmarks_with_reminders = true
bookmarks_with_reminders_val =
DB.query_single(
"SELECT value FROM site_settings WHERE name = 'enable_bookmarks_with_reminders'",
)
if bookmarks_with_reminders_val.present?
DB.exec("UPDATE site_settings SET value = 't' WHERE name = 'enable_bookmarks_with_reminders'")
else
# data_type 5 is boolean
DB.exec(<<~SQL)
INSERT INTO site_settings(name, value, data_type, created_at, updated_at)
VALUES('enable_bookmarks_with_reminders', 't', 5, NOW(), NOW())
SQL
end
bookmarks_to_create = []
loop do

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class DeleteOldBookmarkReminderSetting < ActiveRecord::Migration[7.0]
def up
DB.exec("DELETE FROM site_settings WHERE name = 'enable_bookmarks_with_reminders'")
end
def down
raise ActiveRecord::IrreversibleMigration
end
end