Skip to content

Commit

Permalink
[Fix-apache#3487][sql] update uc_dolphin_T_t_ds_resources_un
Browse files Browse the repository at this point in the history
  • Loading branch information
lgcareer committed Oct 15, 2020
1 parent 68c59fa commit dbc9f14
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sql/upgrade/1.3.3_schema/postgresql/dolphinscheduler_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit dbc9f14

Please sign in to comment.