Files
FullAutoWaterCheck/db/upgrade_scandata_add_new_fields.sql
2026-02-04 20:05:55 +08:00

34 lines
985 B
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.
-- 为scandata表添加新字段刻字号、数量、压差设置、标准误差
-- 执行日期2026-02-04
USE fullautowaterpressure;
-- 添加刻字号字段
ALTER TABLE scandata
ADD COLUMN IF NOT EXISTS EngravingNumber VARCHAR(100) DEFAULT '' COMMENT '刻字号';
-- 添加数量字段
ALTER TABLE scandata
ADD COLUMN IF NOT EXISTS Quantity INT DEFAULT 0 COMMENT '数量';
-- 添加压差设置字段
ALTER TABLE scandata
ADD COLUMN IF NOT EXISTS PressureDifference FLOAT DEFAULT 0 COMMENT '压差设置';
-- 添加标准误差字段
ALTER TABLE scandata
ADD COLUMN IF NOT EXISTS StandardError FLOAT DEFAULT 0 COMMENT '标准误差';
-- 验证字段是否添加成功
SELECT
COLUMN_NAME,
DATA_TYPE,
COLUMN_DEFAULT,
COLUMN_COMMENT
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_SCHEMA = 'fullautowaterpressure'
AND TABLE_NAME = 'scandata'
AND COLUMN_NAME IN ('EngravingNumber', 'Quantity', 'PressureDifference', 'StandardError');