-- Flyway migration V2 — switch boolean flag columns from TINYINT(1) to BIT(1).
--
-- Why: BIT(1) gives strict 0/1 storage at the type level. MySQL Connector/J 8.x
-- maps BIT(1) ↔ Boolean automatically (no driver param needed). MyBatis-Plus
-- entity fields stay `Boolean`, no Java code changes required. Existing queries
-- like `WHERE bDeleted = 0` continue to work because MySQL implicitly converts
-- integer literals to bit values.
--
-- ALTER TABLE on a populated table preserves data: TINYINT 0 → BIT b'0',
-- TINYINT 1 → BIT b'1'. Indexes (e.g. idx_deleted_login) survive the modify.

ALTER TABLE `tUser`
  MODIFY COLUMN `bCanModifyDocs` BIT(1) NOT NULL DEFAULT b'0' COMMENT '单据修改权限；0 否 / 1 是',
  MODIFY COLUMN `bDeleted`       BIT(1) NOT NULL DEFAULT b'0' COMMENT '软删除标记；0 有效 / 1 已作废';

ALTER TABLE `tStaff`
  MODIFY COLUMN `bDeleted`       BIT(1) NOT NULL DEFAULT b'0' COMMENT '软删除标记';

ALTER TABLE `tPermissionCategory`
  MODIFY COLUMN `bDeleted`       BIT(1) NOT NULL DEFAULT b'0' COMMENT '软删除标记';

ALTER TABLE `tModule`
  MODIFY COLUMN `bShowPermission` BIT(1) NOT NULL DEFAULT b'0' COMMENT '权限是否显示；0 否 / 1 是',
  MODIFY COLUMN `bDeleted`        BIT(1) NOT NULL DEFAULT b'0' COMMENT '软删除标记';
