ALTER TABLE `room_decor_placements`
  ADD COLUMN IF NOT EXISTS `mutation_revision` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后修改该摆件的布局版本' AFTER `z_index`;

CREATE TABLE IF NOT EXISTS `room_decor_layout_state` (
  `user_id` BIGINT NOT NULL COMMENT '关联users.id',
  `revision` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '当前布局版本',
  `last_mutation_id` VARCHAR(64) NULL COMMENT '最后一次幂等mutation ID',
  `last_mutation_scope` VARCHAR(120) NULL COMMENT '最后一次mutation作用域',
  `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `room_decor_layout_state`
  ADD COLUMN IF NOT EXISTS `last_mutation_scope` VARCHAR(120) NULL COMMENT '最后一次mutation作用域' AFTER `last_mutation_id`;
