Skip to content

A platform for community discussion. Free, open, simple.

DEV: Migrate discourse-livestream setting values to core calendar settings (#40673)

Martin Brennan7ed9e4c111dc
diff --git a/db/structure.sql b/db/structure.sql
index b8766be32e6..62a6878b7b2 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -21912,6 +21912,7 @@ ALTER TABLE ONLY public.ad_plugin_house_ads_groups
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
+('20260609050938'),
('20260607161322'),
('20260604052235'),
('20260603115312'),
diff --git a/plugins/discourse-calendar/config/settings.yml b/plugins/discourse-calendar/config/settings.yml
index 4cf75914313..1140fdd2d06 100644
--- a/plugins/discourse-calendar/config/settings.yml
+++ b/plugins/discourse-calendar/config/settings.yml
@@ -142,7 +142,6 @@ discourse_calendar:
livestream_enabled:
default: false
client: true
- hidden: true
livestream_embeddable_chat_allowed_paths:
type: list
default: "/t"
@@ -151,9 +150,7 @@ discourse_calendar:
livestream_enable_modal_chat_on_mobile:
default: true
client: true
- hidden: true
livestream_chat_allowed_groups:
default: "11" # default group trust_level_1
client: true
- type: group_list
- hidden: true
\ No newline at end of file
+ type: group_list
\ No newline at end of file
diff --git a/plugins/discourse-calendar/db/migrate/20260609050938_copy_livestream_settings_to_calendar.rb b/plugins/discourse-calendar/db/migrate/20260609050938_copy_livestream_settings_to_calendar.rb
new file mode 100644
index 00000000000..d564a8111bc
--- /dev/null
+++ b/plugins/discourse-calendar/db/migrate/20260609050938_copy_livestream_settings_to_calendar.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+class CopyLivestreamSettingsToCalendar < ActiveRecord::Migration[8.0]
+ def up
+ execute <<~SQL
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ SELECT 'livestream_embeddable_chat_allowed_paths', data_type, value, created_at, updated_at
+ FROM site_settings
+ WHERE name = 'discourse_livestream_embeddable_chat_allowed_paths'
+ ON CONFLICT (name) DO NOTHING
+ SQL
+
+ execute <<~SQL
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ SELECT 'livestream_enable_modal_chat_on_mobile', data_type, value, created_at, updated_at
+ FROM site_settings
+ WHERE name = 'discourse_livestream_enable_modal_chat_on_mobile'
+ ON CONFLICT (name) DO NOTHING
+ SQL
+
+ execute <<~SQL
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ SELECT 'livestream_chat_allowed_groups', data_type, value, created_at, updated_at
+ FROM site_settings
+ WHERE name = 'discourse_livestream_chat_allowed_groups'
+ ON CONFLICT (name) DO NOTHING
+ SQL
+
+ livestream_plugin_enabled =
+ DB.query_single(
+ "SELECT value FROM site_settings WHERE name = 'discourse_livestream_enabled' AND value = 't'",
+ )
+ return if livestream_plugin_enabled.blank?
+
+ execute <<~SQL
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ SELECT 'livestream_enabled', 5, 't', NOW(), NOW()
+ ON CONFLICT (name) DO NOTHING
+ SQL
+
+ execute <<~SQL
+ UPDATE site_settings SET value = 'f' WHERE name = 'discourse_livestream_enabled'
+ SQL
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end