Browse Source

fix: Upgrade database DDL to avoid log path too long error

3.0.0/version-upgrade
Jiajie Zhong 2 years ago
parent
commit
c31087bd95
  1. 2
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
  2. 2
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
  3. 2
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
  4. 18
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/mysql/dolphinscheduler_ddl.sql
  5. 3
      dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/postgresql/dolphinscheduler_ddl.sql

2
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql

@ -844,7 +844,7 @@ CREATE TABLE t_ds_task_instance
end_time datetime DEFAULT NULL,
host varchar(135) DEFAULT NULL,
execute_path varchar(200) DEFAULT NULL,
log_path varchar(200) DEFAULT NULL,
log_path longtext DEFAULT NULL,
alert_flag tinyint(4) DEFAULT NULL,
retry_times int(4) DEFAULT '0',
pid int(4) DEFAULT NULL,

2
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql

@ -837,7 +837,7 @@ CREATE TABLE `t_ds_task_instance` (
`end_time` datetime DEFAULT NULL COMMENT 'task end time',
`host` varchar(135) DEFAULT NULL COMMENT 'host of task running on',
`execute_path` varchar(200) DEFAULT NULL COMMENT 'task execute path in the host',
`log_path` varchar(200) DEFAULT NULL COMMENT 'task log path',
`log_path` longtext DEFAULT NULL COMMENT 'task log path',
`alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert',
`retry_times` int(4) DEFAULT '0' COMMENT 'task retry times',
`pid` int(4) DEFAULT NULL COMMENT 'pid of task',

2
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

@ -742,7 +742,7 @@ CREATE TABLE t_ds_task_instance (
end_time timestamp DEFAULT NULL ,
host varchar(135) DEFAULT NULL ,
execute_path varchar(200) DEFAULT NULL ,
log_path varchar(200) DEFAULT NULL ,
log_path text DEFAULT NULL ,
alert_flag int DEFAULT NULL ,
retry_times int DEFAULT '0' ,
pid int DEFAULT NULL ,

18
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/mysql/dolphinscheduler_ddl.sql

@ -477,6 +477,24 @@ delimiter ;
CALL add_t_ds_alert_col_project_code;
DROP PROCEDURE add_t_ds_alert_col_project_code;
-- t_ds_task_instance
drop PROCEDURE if EXISTS alter_t_ds_task_instance_col_log_path;
delimiter d//
CREATE PROCEDURE alter_t_ds_task_instance_col_log_path()
BEGIN
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='t_ds_task_instance'
AND TABLE_SCHEMA=(SELECT DATABASE())
AND COLUMN_NAME='log_path')
THEN
ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `log_path` longtext DEFAULT NULL COMMENT 'task log path';
END IF;
END;
d//
delimiter ;
CALL alter_t_ds_task_instance_col_log_path;
DROP PROCEDURE alter_t_ds_task_instance_col_log_path;
--
-- Table structure for table `t_ds_dq_comparison_type`
--

3
dolphinscheduler-dao/src/main/resources/sql/upgrade/3.0.0_schema/postgresql/dolphinscheduler_ddl.sql

@ -18,6 +18,9 @@
--- Drop table: Some table forget delete in the past, should be delete in version 1.2.0
DROP TABLE IF EXISTS t_ds_worker_server;
--- alter table
ALTER TABLE t_ds_task_instance ALTER COLUMN log_path TYPE text;
--- Add CONSTRAINT key
ALTER TABLE t_ds_task_instance DROP CONSTRAINT IF EXISTS foreign_key_instance_id;
ALTER TABLE t_ds_task_instance ADD CONSTRAINT foreign_key_instance_id FOREIGN KEY(process_instance_id) REFERENCES t_ds_process_instance(id) ON DELETE CASCADE;

Loading…
Cancel
Save