hyapp-server/server/admin/migrations/030_salary_policy_trigger_mode.sql
2026-05-29 19:56:14 +08:00

25 lines
1.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
SET @now_ms = CAST(UNIX_TIMESTAMP(UTC_TIMESTAMP(3)) * 1000 AS UNSIGNED);
-- 触发方式是自动任务和人工结算的配置边界;老环境执行过 027 时需要幂等补列。
SET @ddl := IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'admin_host_agency_salary_policies' AND COLUMN_NAME = 'settlement_trigger_mode') = 0,
'ALTER TABLE admin_host_agency_salary_policies ADD COLUMN settlement_trigger_mode VARCHAR(24) NOT NULL DEFAULT ''automatic'' COMMENT ''结算触发方式automatic/manual'' AFTER settlement_mode',
'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 产品菜单统一叫“工资结算”,页面可同时承载待结算与历史记录查询。
UPDATE admin_menus
SET title = '工资结算',
updated_at_ms = @now_ms
WHERE code = 'host-salary-settlement';
UPDATE admin_permissions
SET name = '工资结算查看',
updated_at_ms = @now_ms
WHERE code = 'host-salary-settlement:view';