Index: openacs-4/packages/acs-kernel/acs-kernel.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v diff -u -r1.86.2.10 -r1.86.2.11 --- openacs-4/packages/acs-kernel/acs-kernel.info 7 May 2007 12:52:02 -0000 1.86.2.10 +++ openacs-4/packages/acs-kernel/acs-kernel.info 6 Jun 2007 12:47:46 -0000 1.86.2.11 @@ -7,15 +7,15 @@ t t - + OpenACS Core Team Routines and data models providing the foundation for OpenACS-based Web services. 2007-04-22 OpenACS The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, partiies and the supporting PL/SQL and PL/pgSQL procedures. 3 - + Index: openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.3.2d1-5.3.2d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.3.2d1-5.3.2d2.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.3.2d1-5.3.2d2.sql 24 May 2007 12:16:27 -0000 1.1.2.1 +++ openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.3.2d1-5.3.2d2.sql 6 Jun 2007 12:47:46 -0000 1.1.2.2 @@ -6,6 +6,18 @@ -- @cvs-id $Id$ -- -alter table apm_parameters drop constraint apm_parameter_datatype_ck; -alter table apm_parameters add constraint apm_parameter_datatype_ck check(datat\ -ype in ('number', 'string','text')); \ No newline at end of file +declare v_result integer; +begin +select count(*) into v_result from user_constraints where constraint_name = 'apm_parameters_datatype_ck'; +if v_result > 0 then + execute immediate 'alter table apm_parameters drop constraint ''apm_parameters_datatype_ck'''; +end if; +select count(*) into v_result from user_constraints where constraint_name = 'apm_parameter_datatype_ck'; +if v_result > 0 then +execute immediate 'alter table apm_parameters drop constraint ''apm_parameter_datatype_ck'''; +end if; +execute immediate 'alter table apm_parameters add constraint apm_parameters_datatype_ck check(datatype in (''number'', ''string'',''text''))'; +end; +/ +show errors + Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.2d1-5.3.2d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.2d1-5.3.2d2.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.2d1-5.3.2d2.sql 24 May 2007 12:16:27 -0000 1.1.2.1 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.2d1-5.3.2d2.sql 6 Jun 2007 12:47:46 -0000 1.1.2.2 @@ -5,7 +5,18 @@ -- @creation-date 2007-05-24 -- @cvs-id $Id$ -- +create or replace function inline_0() returns integer as ' -alter table apm_parameters drop constraint apm_parameter_datatype_ck; -alter table apm_parameters add constraint apm_parameter_datatype_ck check(datat\ -ype in ('number', 'string','text')); \ No newline at end of file +begin + if (select count(*) from pg_constraint where conname=''apm_parameters_datatype_ck'') > 0 then + alter table apm_parameters drop constraint apm_parameters_datatype_ck; + end if; + if (select count(*) from pg_constraint where conname=''apm_parameter_datatype_ck'') > 0 then + alter table apm_parameters drop constraint apm_parameter_datatype_ck; + end if; + alter table apm_parameters add constraint apm_parameters_datatype_ck check(datatype in (''number'', ''string'',''text'')); + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0();