fix: fan out receipts and align tenant schema

This commit is contained in:
richjohnrambo
2026-09-16 22:09:52 +08:00
parent 6729f40665
commit 0ae4af0c31
6 changed files with 314 additions and 3 deletions
@@ -1,14 +1,34 @@
-- Add personal privacy switch for requiring approval when others invite the user into a group.
-- Default is off to preserve existing behavior.
-- Run this for every tenant business database. The current test environment uses:
-- default -> tinode
-- system -> meeting_im
SET @im_schema = 'tinode';
SET @im_sql = (
SELECT IF(
COUNT(*) = 0,
'ALTER TABLE tinode.im_user_privacy_settings ADD COLUMN group_invite_verification TINYINT NOT NULL DEFAULT 0 AFTER read_receipts',
CONCAT('ALTER TABLE ', @im_schema, '.im_user_privacy_settings ADD COLUMN group_invite_verification TINYINT NOT NULL DEFAULT 0 AFTER read_receipts'),
'SELECT 1'
)
FROM information_schema.columns
WHERE table_schema = 'tinode'
WHERE table_schema = @im_schema
AND table_name = 'im_user_privacy_settings'
AND column_name = 'group_invite_verification'
);
PREPARE im_stmt FROM @im_sql;
EXECUTE im_stmt;
DEALLOCATE PREPARE im_stmt;
SET @im_schema = 'meeting_im';
SET @im_sql = (
SELECT IF(
COUNT(*) = 0,
CONCAT('ALTER TABLE ', @im_schema, '.im_user_privacy_settings ADD COLUMN group_invite_verification TINYINT NOT NULL DEFAULT 0 AFTER read_receipts'),
'SELECT 1'
)
FROM information_schema.columns
WHERE table_schema = @im_schema
AND table_name = 'im_user_privacy_settings'
AND column_name = 'group_invite_verification'
);