|
|
@ -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(); |
|
|
|