dolphinscheduler_ddl.sql 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
  18. -- uc_dolphin_T_t_ds_task_instance_A_first_submit_time
  19. drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_A_first_submit_time;
  20. delimiter d//
  21. CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_A_first_submit_time()
  22. BEGIN
  23. IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
  24. WHERE TABLE_NAME='t_ds_task_instance'
  25. AND TABLE_SCHEMA=(SELECT DATABASE())
  26. AND COLUMN_NAME ='first_submit_time')
  27. THEN
  28. ALTER TABLE t_ds_task_instance ADD `first_submit_time` datetime DEFAULT NULL COMMENT 'task first submit time';
  29. END IF;
  30. END;
  31. d//
  32. delimiter ;
  33. CALL uc_dolphin_T_t_ds_task_instance_A_first_submit_time();
  34. DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_first_submit_time;
  35. -- uc_dolphin_T_t_ds_task_instance_A_delay_time
  36. drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_A_delay_time;
  37. delimiter d//
  38. CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_A_delay_time()
  39. BEGIN
  40. IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
  41. WHERE TABLE_NAME='t_ds_task_instance'
  42. AND TABLE_SCHEMA=(SELECT DATABASE())
  43. AND COLUMN_NAME ='delay_time')
  44. THEN
  45. ALTER TABLE t_ds_task_instance ADD `delay_time` int(4) DEFAULT '0' COMMENT 'task delay execution time';
  46. END IF;
  47. END;
  48. d//
  49. delimiter ;
  50. CALL uc_dolphin_T_t_ds_task_instance_A_delay_time();
  51. DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_delay_time;
  52. -- uc_dolphin_T_t_ds_task_instance_A_var_pool
  53. drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_A_var_pool;
  54. delimiter d//
  55. CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_A_var_pool()
  56. BEGIN
  57. IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
  58. WHERE TABLE_NAME='t_ds_task_instance'
  59. AND TABLE_SCHEMA=(SELECT DATABASE())
  60. AND COLUMN_NAME ='var_pool')
  61. THEN
  62. ALTER TABLE t_ds_task_instance ADD `var_pool` longtext NULL;
  63. END IF;
  64. END;
  65. d//
  66. delimiter ;
  67. CALL uc_dolphin_T_t_ds_task_instance_A_var_pool();
  68. DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_var_pool;
  69. -- uc_dolphin_T_t_ds_process_instance_A_var_pool
  70. drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_process_instance_A_var_pool;
  71. delimiter d//
  72. CREATE PROCEDURE uc_dolphin_T_t_ds_process_instance_A_var_pool()
  73. BEGIN
  74. IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS
  75. WHERE TABLE_NAME='t_ds_process_instance'
  76. AND TABLE_SCHEMA=(SELECT DATABASE())
  77. AND COLUMN_NAME ='var_pool')
  78. THEN
  79. ALTER TABLE t_ds_process_instance ADD `var_pool` longtext NULL;
  80. END IF;
  81. END;
  82. d//
  83. delimiter ;
  84. CALL uc_dolphin_T_t_ds_process_instance_A_var_pool();
  85. DROP PROCEDURE uc_dolphin_T_t_ds_process_instance_A_var_pool;
  86. -- uc_dolphin_T_t_ds_process_definition_A_modify_by
  87. drop PROCEDURE if EXISTS ct_dolphin_T_t_ds_process_definition_version;
  88. delimiter d//
  89. CREATE PROCEDURE ct_dolphin_T_t_ds_process_definition_version()
  90. BEGIN
  91. CREATE TABLE IF NOT EXISTS `t_ds_process_definition_version` (
  92. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
  93. `process_definition_id` int(11) NOT NULL COMMENT 'process definition id',
  94. `version` int(11) DEFAULT NULL COMMENT 'process definition version',
  95. `process_definition_json` longtext COMMENT 'process definition json content',
  96. `description` text,
  97. `global_params` text COMMENT 'global parameters',
  98. `locations` text COMMENT 'Node location information',
  99. `connects` text COMMENT 'Node connection information',
  100. `receivers` text COMMENT 'receivers',
  101. `receivers_cc` text COMMENT 'cc',
  102. `create_time` datetime DEFAULT NULL COMMENT 'create time',
  103. `timeout` int(11) DEFAULT '0' COMMENT 'time out',
  104. `resource_ids` varchar(255) DEFAULT NULL COMMENT 'resource ids',
  105. PRIMARY KEY (`id`),
  106. UNIQUE KEY `process_definition_id_and_version` (`process_definition_id`,`version`) USING BTREE,
  107. KEY `process_definition_index` (`id`) USING BTREE
  108. ) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8;
  109. END;
  110. d//
  111. delimiter ;
  112. CALL ct_dolphin_T_t_ds_process_definition_version;
  113. DROP PROCEDURE ct_dolphin_T_t_ds_process_definition_version;
  114. -- add t_ds_resources_un
  115. DROP PROCEDURE IF EXISTS uc_dolphin_T_t_ds_resources_un;
  116. delimiter d//
  117. CREATE PROCEDURE uc_dolphin_T_t_ds_resources_un()
  118. BEGIN
  119. IF NOT EXISTS (
  120. SELECT * FROM information_schema.KEY_COLUMN_USAGE
  121. WHERE TABLE_NAME = 't_ds_resources'
  122. AND CONSTRAINT_NAME = 't_ds_resources_un'
  123. )
  124. THEN
  125. ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE KEY (full_name,`type`);
  126. END IF;
  127. END;
  128. d//
  129. delimiter ;
  130. CALL uc_dolphin_T_t_ds_resources_un();
  131. DROP PROCEDURE IF EXISTS uc_dolphin_T_t_ds_resources_un;