Browse Source

[Fix-#3487][sql] update uc_dolphin_T_t_ds_resources_un

pull/3/MERGE
lgcareer 4 years ago
parent
commit
dbc9f149b5
  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
delimiter d//
CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_resources_un() RETURNS void AS $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_NAME = 't_ds_resources'
AND CONSTRAINT_NAME = 't_ds_resources_un'
)
IF NOT EXISTS (SELECT 1 FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_NAME = 't_ds_resources'
AND CONSTRAINT_NAME = 't_ds_resources_un')
THEN
ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE (full_name,"type");
END IF;
ALTER TABLE t_ds_resources ADD CONSTRAINT t_ds_resources_un UNIQUE (full_name,"type");
END IF;
END;
$$ LANGUAGE plpgsql;
d//
delimiter ;
SELECT uc_dolphin_T_t_ds_resources_un();
DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_resources_un();

Loading…
Cancel
Save