Commit 78174c42 authored by Weber's avatar Weber

- Fixing Weber left over data types from chat, cms and other packages

parent b94f7fd1
......@@ -91,6 +91,37 @@ END;
$$ LANGUAGE plpgsql;
-- fraber 2021-01-26: Issues upgrading Weber
--
create or replace function inline_0 ()
returns integer as $body$
declare
row RECORD;
BEGIN
FOR row IN
select ot.object_type, ot.table_name
from acs_object_types ot
where not exists (
select *
from information_schema.tables ist
where lower(ot.table_name) = lower(ist.table_name)
)
and object_type in ('ams_object_revision', 'journal_article', 'journal_issue', 'news_item')
order by ot.object_type
LOOP
delete from acs_attributes where object_type = row.object_type;
delete from im_rest_object_types where object_type = row.object_type;
delete from acs_objects where object_type = row.object_type;
delete from acs_object_types where object_type = row.object_type;
END LOOP;
return 0;
end;$body$ language 'plpgsql';
select inline_0 ();
drop function inline_0 ();
-- upgrade types
WITH RECURSIVE cr_types as (
......@@ -99,3 +130,4 @@ UNION ALL
select ot.object_type from acs_object_types ot,cr_types
where ot.supertype = cr_types.object_type
) select object_type, content_type__refresh_view(object_type) from cr_types;
......@@ -23,6 +23,11 @@ FOREIGN KEY (child_id) REFERENCES cr_items(item_id) ON DELETE CASCADE;
--
-- Add FK constraints for cr_item_rels with cascade operations
--
-- fraber 2021-01-26: Issues upgrading Weber
delete from cr_item_rels where item_id in (select item_id from cr_item_rels cir where not exists (select * from cr_items ci where ci.item_id = cir.item_id));
ALTER TABLE cr_item_rels DROP CONSTRAINT IF EXISTS cr_item_rels_item_id_fk;
ALTER TABLE cr_item_rels ADD CONSTRAINT cr_item_rels_item_id_fk
FOREIGN KEY (item_id) REFERENCES cr_items(item_id) ON DELETE CASCADE;
......
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