dolphinscheduler_ddl.sql 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. -- uc_dolphin_T_t_ds_datasource_A_note
  18. delimiter d//
  19. CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_datasource_A_note() RETURNS void AS $$
  20. BEGIN
  21. IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
  22. WHERE TABLE_NAME='t_ds_datasource'
  23. AND COLUMN_NAME ='note')
  24. THEN
  25. ALTER TABLE t_ds_datasource ALTER COLUMN note type varchar(255);
  26. END IF;
  27. END;
  28. $$ LANGUAGE plpgsql;
  29. d//
  30. delimiter ;
  31. SELECT uc_dolphin_T_t_ds_datasource_A_note();
  32. DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_datasource_A_note();
  33. -- uc_dolphin_T_t_ds_resources_A_description
  34. delimiter d//
  35. CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_A_description() RETURNS void AS $$
  36. BEGIN
  37. IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
  38. WHERE TABLE_NAME='t_ds_resources'
  39. AND COLUMN_NAME ='description')
  40. THEN
  41. ALTER TABLE t_ds_resources ALTER COLUMN description type varchar(255);
  42. END IF;
  43. END;
  44. $$ LANGUAGE plpgsql;
  45. d//
  46. delimiter ;
  47. SELECT uc_dolphin_T_t_ds_resources_A_description();
  48. DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_A_description();
  49. -- uc_dolphin_T_t_ds_schedules_A_crontab
  50. delimiter d//
  51. CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_schedules_A_crontab() RETURNS void AS $$
  52. BEGIN
  53. IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
  54. WHERE TABLE_NAME='t_ds_schedules'
  55. AND COLUMN_NAME ='crontab')
  56. THEN
  57. ALTER TABLE t_ds_schedules ALTER COLUMN crontab type varchar(255);
  58. END IF;
  59. END;
  60. $$ LANGUAGE plpgsql;
  61. d//
  62. delimiter ;
  63. SELECT uc_dolphin_T_t_ds_schedules_A_crontab();
  64. DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_A_crontab();
  65. -- uc_dolphin_T_t_ds_tenant_A_description
  66. delimiter d//
  67. CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_tenant_A_description() RETURNS void AS $$
  68. BEGIN
  69. IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
  70. WHERE TABLE_NAME='t_ds_tenant'
  71. AND COLUMN_NAME ='description')
  72. THEN
  73. ALTER TABLE t_ds_tenant ALTER COLUMN description type varchar(255);
  74. END IF;
  75. END;
  76. $$ LANGUAGE plpgsql;
  77. d//
  78. delimiter ;
  79. SELECT uc_dolphin_T_t_ds_tenant_A_description();
  80. DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_tenant_A_description();
  81. -- uc_dolphin_T_t_ds_worker_group_A_name
  82. delimiter d//
  83. CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_worker_group_A_name() RETURNS void AS $$
  84. BEGIN
  85. IF EXISTS (SELECT 1 FROM information_schema.COLUMNS
  86. WHERE TABLE_NAME='t_ds_worker_group'
  87. AND COLUMN_NAME ='name')
  88. THEN
  89. ALTER TABLE t_ds_worker_group ALTER COLUMN name type varchar(255);
  90. END IF;
  91. END;
  92. $$ LANGUAGE plpgsql;
  93. d//
  94. delimiter ;
  95. SELECT uc_dolphin_T_t_ds_worker_group_A_name();
  96. DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_worker_group_A_name();