Browse Source

Merge pull request #3919 from lgcareer/1.3.3-release-fix#3789

[Fix-#3487][sql] update uc_dolphin_T_t_ds_resources_un
pull/3/MERGE
xingchun-chen 4 years ago committed by GitHub
parent
commit
5018117edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql

15
sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql

@ -16,18 +16,19 @@
*/ */
-- add t_ds_resources_un -- add t_ds_resources_un
delimiter d//
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_un() RETURNS void AS $$ CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_un() RETURNS void AS $$
BEGIN BEGIN
IF NOT EXISTS ( IF NOT EXISTS (SELECT 1 FROM information_schema.KEY_COLUMN_USAGE
SELECT 1 FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't_ds_resources'
WHERE TABLE_NAME = 't_ds_resources' AND CONSTRAINT_NAME = 't_ds_resources_un')
AND CONSTRAINT_NAME = 't_ds_resources_un'
)
THEN THEN
ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE (full_name,"type"); ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE (full_name,"type");
END IF; END IF;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
d//
delimiter ;
SELECT uc_dolphin_T_t_ds_resources_un(); SELECT uc_dolphin_T_t_ds_resources_un();
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_un(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_un();

Loading…
Cancel
Save