Commit ea4ee650 authored by Frank Bergmann's avatar Frank Bergmann

- added param_name as a required argument

parent 4ae377da
...@@ -80,6 +80,9 @@ create table im_sla_parameters ( ...@@ -80,6 +80,9 @@ create table im_sla_parameters (
-- Every ]po[ object should have a "status_id" to control -- Every ]po[ object should have a "status_id" to control
-- its lifecycle. Status_id reference im_categories, where -- its lifecycle. Status_id reference im_categories, where
-- you can define the list of stati for this object type. -- you can define the list of stati for this object type.
param_name text
constraint im_sla_parameter_name_nn
not null,
param_status_id integer param_status_id integer
constraint im_sla_parameter_status_nn constraint im_sla_parameter_status_nn
not null not null
...@@ -118,9 +121,13 @@ create table im_sla_parameters ( ...@@ -118,9 +121,13 @@ create table im_sla_parameters (
create index im_sla_parameters_sla_idx on im_sla_parameters(param_sla_id); create index im_sla_parameters_sla_idx on im_sla_parameters(param_sla_id);
-- Avoid duplicate entries. -- Avoid duplicate entries.
-- Make an exception and skip this step here and accept -- Every ]po[ object should contain one such "unique" constraint in order
-- that there may be duplicates. -- to avoid creating duplicate entries during data import or if the user
-- Shis shouldn't be critical for the app... -- performs a "double-click" on the "Create New Note" button...
-- (This makes a lot of sense in practice. Otherwise there would be loads
-- of duplicated projects in the system and worse...)
create unique index im_sla_parameters_un_idx on im_sla_parameters(param_name, param_sla_id);
...@@ -148,7 +155,7 @@ DECLARE ...@@ -148,7 +155,7 @@ DECLARE
p_param_id alias for $1; p_param_id alias for $1;
v_name varchar; v_name varchar;
BEGIN BEGIN
select substring(param_note for 30) select substring(param_name for 30)
into v_name into v_name
from im_sla_parameters from im_sla_parameters
where param_id = p_param_id; where param_id = p_param_id;
...@@ -167,7 +174,7 @@ end;' language 'plpgsql'; ...@@ -167,7 +174,7 @@ end;' language 'plpgsql';
create or replace function im_sla_parameter__new ( create or replace function im_sla_parameter__new (
integer, varchar, timestamptz, integer, varchar, timestamptz,
integer, varchar, integer, integer, varchar, integer,
varchar, integer, varchar, varchar, integer,
integer, integer integer, integer
) returns integer as ' ) returns integer as '
DECLARE DECLARE
...@@ -180,10 +187,11 @@ DECLARE ...@@ -180,10 +187,11 @@ DECLARE
p_context_id alias for $6; -- context_id default null p_context_id alias for $6; -- context_id default null
-- Specific parameters with data to go into the im_sla_management table -- Specific parameters with data to go into the im_sla_management table
p_param_sla_id alias for $7; -- SLA for the parameter p_param_name alias for $7; -- Unique name
p_param_type_id alias for $8; -- type p_param_sla_id alias for $8; -- SLA for the parameter
p_param_status_id alias for $9; -- status ("active" or "deleted"). p_param_type_id alias for $9; -- type
p_param_note alias for $10; -- name/comment for the parameter p_param_status_id alias for $10; -- status ("active" or "deleted").
p_param_note alias for $11; -- name/comment for the parameter
-- This is a variable for the PL/SQL function -- This is a variable for the PL/SQL function
v_param_id integer; v_param_id integer;
...@@ -204,10 +212,10 @@ BEGIN ...@@ -204,10 +212,10 @@ BEGIN
-- Create an entry in the im_sla_management table with the same -- Create an entry in the im_sla_management table with the same
-- v_param_id from acs_objects.object_id -- v_param_id from acs_objects.object_id
insert into im_sla_parameters ( insert into im_sla_parameters (
param_id, param_sla_id, param_id, param_name, param_sla_id,
param_type_id, param_status_id param_type_id, param_status_id
) values ( ) values (
v_param_id, v_param_sla_id, v_param_id, v_param_name, v_param_sla_id,
p_param_type_id, p_param_status_id p_param_type_id, p_param_status_id
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment