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 -N -r1.150.2.22 -r1.150.2.23 --- openacs-4/packages/acs-kernel/acs-kernel.info 4 Mar 2020 18:15:32 -0000 1.150.2.22 +++ openacs-4/packages/acs-kernel/acs-kernel.info 5 Mar 2020 17:56:59 -0000 1.150.2.23 @@ -9,15 +9,15 @@ f t - + OpenACS Core Team Routines and data models providing the foundation for OpenACS-based Web services. 2017-08-06 OpenACS The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, parties and the supporting PL/SQL and PL/pgSQL procedures. 3 - + Index: openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.10.0d25-5.10.0d26.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/upgrade/Attic/upgrade-5.10.0d25-5.10.0d26.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.10.0d25-5.10.0d26.sql 5 Mar 2020 17:56:59 -0000 1.1.2.1 @@ -0,0 +1,57 @@ +-- +-- Attribute discrepancy fix for object_types in OpenACS: +-- +-- Some attributes are not created for new instances since 2006, but an upgrade +-- script deleting the already existing ones was never done. +-- +-- This one tries to fix this. +-- +-- Original datatype change: +-- https://fisheye.openacs.org/changelog/OpenACS?cs=MAIN%3Avictorg%3A20060727200933 +-- https://github.com/openacs/openacs-core/commit/7e30fa270483dcbc866ffbf6f5cf4f30447987cb +-- + +begin; + +create or replace procedure inline_0 ( + object_type in varchar2, + attribute_name in varchar2 +) +is + v_attribute_exists integer; +begin + -- Check that attribute exists + select decode(count(*),0,0,1) into v_attribute_exists + from acs_object_types t, acs_attributes a + where a.object_type = drop_attribute.object_type + and a.attribute_name = drop_attribute.attribute_name + and t.object_type = drop_attribute.object_type; + + if v_attribute_exists = 1 then + + -- First remove possible values for the enumeration + delete from acs_enum_values + where attribute_id in (select a.attribute_id + from acs_attributes a + where a.object_type = drop_attribute.object_type + and a.attribute_name = drop_attribute.attribute_name); + + -- Finally, get rid of the attribute + delete from acs_attributes + where object_type = drop_attribute.object_type + and attribute_name = drop_attribute.attribute_name; + + end if; + +end inline0; +/ + +select inline_0('apm_package','package_uri') from dual; +select inline_0('apm_package','spec_file_path') from dual; +select inline_0('apm_package','spec_file_mtime') from dual; +select inline_0('apm_package','singleton_p') from dual; +select inline_0('apm_package','initial_install_p') from dual; + +drop procedure inline_0; + +commit; Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.10.0d25-5.10.0d26.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/Attic/upgrade-5.10.0d25-5.10.0d26.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.10.0d25-5.10.0d26.sql 5 Mar 2020 17:56:59 -0000 1.1.2.1 @@ -0,0 +1,60 @@ +-- +-- Attribute discrepancy fix for object_types in OpenACS: +-- +-- Some attributes are not created for new instances since 2006, but an upgrade +-- script deleting the already existing ones was never done. +-- +-- This one tries to fix this. +-- +-- Original datatype change: +-- https://fisheye.openacs.org/changelog/OpenACS?cs=MAIN%3Avictorg%3A20060727200933 +-- https://github.com/openacs/openacs-core/commit/7e30fa270483dcbc866ffbf6f5cf4f30447987cb +-- + +begin; + +CREATE OR REPLACE FUNCTION inline_0( + p_object_type varchar, + p_attribute_name varchar + +) RETURNS integer AS $$ +DECLARE + v_table_name acs_object_types.table_name%TYPE; +BEGIN + + -- Check that attribute exists + select t.table_name into v_table_name + from acs_object_types t, acs_attributes a + where a.object_type = p_object_type + and a.attribute_name = p_attribute_name + and t.object_type = p_object_type; + + if found then + + -- First remove possible values for the enumeration + delete from acs_enum_values + where attribute_id in (select a.attribute_id + from acs_attributes a + where a.object_type = p_object_type + and a.attribute_name = p_attribute_name); + + -- Finally, get rid of the attribute + delete from acs_attributes + where object_type = p_object_type + and attribute_name = p_attribute_name; + + end if; + + return null; +END; +$$ LANGUAGE plpgsql; + +select inline_0('apm_package','package_uri'); +select inline_0('apm_package','spec_file_path'); +select inline_0('apm_package','spec_file_mtime'); +select inline_0('apm_package','singleton_p'); +select inline_0('apm_package','initial_install_p'); + +drop function inline_0(varchar,varchar); + +end;