You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
USE `data_center_new`;
|
|
|
|
DROP procedure IF EXISTS `add_column`;
|
|
|
|
DELIMITER $$
|
|
|
|
CREATE PROCEDURE add_column()
|
|
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT *
|
|
FROM information_schema.columns
|
|
WHERE table_schema = 'data_center_new'
|
|
AND table_name = 'basic_monitoring_asset'
|
|
AND column_name = 'user_manual'
|
|
) THEN
|
|
ALTER TABLE basic_monitoring_asset
|
|
ADD COLUMN `user_manual` text COMMENT '用户手册存放地址';
|
|
END IF;
|
|
|
|
IF NOT EXISTS (
|
|
SELECT *
|
|
FROM information_schema.columns
|
|
WHERE table_schema = 'data_center_new'
|
|
AND table_name = 'basic_monitoring_asset'
|
|
AND column_name = 'device_image'
|
|
) THEN
|
|
ALTER TABLE basic_monitoring_asset
|
|
ADD COLUMN `device_image` text COMMENT '设备图片存放地址';
|
|
END IF;
|
|
|
|
IF NOT EXISTS (
|
|
SELECT *
|
|
FROM information_schema.columns
|
|
WHERE table_schema = 'data_center_new'
|
|
AND table_name = 'type'
|
|
AND column_name = 'device_category_id'
|
|
) THEN
|
|
ALTER TABLE `type`
|
|
ADD COLUMN `device_category_id` bigint DEFAULT NULL COMMENT '设备大类ID';
|
|
END IF;
|
|
|
|
IF NOT EXISTS (
|
|
SELECT *
|
|
FROM information_schema.columns
|
|
WHERE table_schema = 'data_center_new'
|
|
AND table_name = 'type'
|
|
AND column_name = 'unit'
|
|
) THEN
|
|
ALTER TABLE `type`
|
|
ADD COLUMN `unit` varchar(255) DEFAULT NULL COMMENT '单位信息';
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|
|
|
|
|
|
CALL add_column();
|
|
|
|
DROP procedure IF EXISTS `add_column`;
|