DEV: Change enable_admin_sidebar_navigation to group setting (#25159)

This will make it easier to do more focused
testing of this change.
This commit is contained in:
Martin Brennan
2024-01-09 09:06:27 +10:00
committed by GitHub
parent e10620bfd3
commit 8c6144d116
15 changed files with 69 additions and 18 deletions

View File

@@ -0,0 +1,22 @@
# frozen_string_literal: true
class ChangeEnableAdminSidebarToGroupPostMigration < ActiveRecord::Migration[7.0]
def change
enable_admin_sidebar_navigation_raw =
DB.query_single(
"SELECT value FROM site_settings WHERE name = 'enable_admin_sidebar_navigation'",
).first
if enable_admin_sidebar_navigation_raw.present?
DB.exec(
"INSERT INTO site_settings(name, value, data_type, created_at, updated_at)
VALUES('admin_sidebar_enabled_groups', :setting, '20', NOW(), NOW())",
setting: "1", # 1 is the Group::AUTO_GROUPS[:admins] group id
)
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end