Commit 01750c59 authored by Frank Bergmann's avatar Frank Bergmann

- debugged create/drop scripts

parent 7128675c
...@@ -218,10 +218,10 @@ create table im_biz_object_members ( ...@@ -218,10 +218,10 @@ create table im_biz_object_members (
-- Intranet Project Role -- Intranet Project Role
); );
BEGIN -- BEGIN
acs_rel_type.create_role ('pm', 'Project Manager', 'Project Managers'); -- acs_rel_type.create_role ('pm', 'Project Manager', 'Project Managers');
END; -- END;
/ -- /
BEGIN BEGIN
......
...@@ -270,15 +270,16 @@ INSERT INTO im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGO ...@@ -270,15 +270,16 @@ INSERT INTO im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGO
-- The "Translation Agency" is a customer -- The "Translation Agency" is a customer
insert into im_category_hierarchy values (57,54); insert into im_category_hierarchy values (57,54);
-- The "IT Consulting" company is a customer. -- The "IT Consulting" company is a customer.
insert into im_category_hierarchy values (57,55); insert into im_category_hierarchy values (57,55);
-- The "Internal" is a customer (internal projects...) -- The "Internal" is a customer (internal projects...)
insert into im_category_hierarchy values (57,53); insert into im_category_hierarchy values (57,53);
-- The "Freelance" company is a provider -- The "Freelance" company is a provider
insert into im_category_hierarchy values (56,58); insert into im_category_hierarchy values (56,58);
-- The "SLV Translation Agency" company is a provider
insert into im_category_hierarchy values (56,58);
-- The "Office Equipment Provider" company is a provider -- The "Office Equipment Provider" company is a provider
insert into im_category_hierarchy values (56,59); insert into im_category_hierarchy values (56,59);
......
...@@ -65,11 +65,11 @@ delete from im_url_types; ...@@ -65,11 +65,11 @@ delete from im_url_types;
delete from im_projects; delete from im_projects;
delete from im_projects_status_audit; delete from im_projects_status_audit;
delete from im_project_status; delete from im_project_status;
delete from im_biz_object_role_map;
delete from im_biz_object_urls;
delete from im_project_types; delete from im_project_types;
drop index im_project_parent_id_idx;
drop table im_projects_status_audit; drop table im_projects_status_audit;
drop table im_project_url_map; drop table im_project_url_map;
drop table im_url_types; drop table im_url_types;
...@@ -95,7 +95,8 @@ drop view im_annual_revenue; ...@@ -95,7 +95,8 @@ drop view im_annual_revenue;
----------------------------------------------------------- -----------------------------------------------------------
-- Auxil tables -- Auxil tables
drop table im_start_blocks; drop table im_start_weeks;
drop table im_start_months;
----------------------------------------------------------- -----------------------------------------------------------
...@@ -106,10 +107,15 @@ drop table im_start_blocks; ...@@ -106,10 +107,15 @@ drop table im_start_blocks;
-- we can delete them early. -- we can delete them early.
drop table im_menus; drop table im_menus;
delete from acs_permissions
where object_id in (
select object_id
from acs_objects
where object_type='im_menu'
)
;
delete from acs_objects where object_type='im_menu'; delete from acs_objects where object_type='im_menu';
drop package im_menu; drop package im_menu;
delete from acs_objects where object_type='im_menu';
begin begin
acs_object_type.drop_type('im_menu'); acs_object_type.drop_type('im_menu');
end; end;
...@@ -124,7 +130,6 @@ commit; ...@@ -124,7 +130,6 @@ commit;
begin begin
im_drop_profile ('P/O Admins'); im_drop_profile ('P/O Admins');
im_drop_profile ('Customers'); im_drop_profile ('Customers');
im_drop_profile ('Offices');
im_drop_profile ('Employees'); im_drop_profile ('Employees');
im_drop_profile ('Freelancers'); im_drop_profile ('Freelancers');
im_drop_profile ('Project Managers'); im_drop_profile ('Project Managers');
...@@ -132,11 +137,50 @@ begin ...@@ -132,11 +137,50 @@ begin
im_drop_profile ('Accounting'); im_drop_profile ('Accounting');
end; end;
/ /
commit;
delete from acs_objects where object_type='im_profile'; begin
for row in (
select profile_id
from im_profiles
) loop
im_profile.del(row.profile_id);
end loop;
end;
/
delete from composition_rels where rel_id in (
select rel_id from acs_rels where object_id_two in (
select object_id from acs_objects where object_type='im_profile'
)
);
delete from composition_rels where rel_id in (
select rel_id from acs_rels where object_id_one in (
select object_id from acs_objects where object_type='im_profile'
)
);
delete from acs_rels where object_id_two in (
select object_id from acs_objects where object_type='im_profile'
);
delete from acs_rels where object_id_one in (
select object_id from acs_objects where object_type='im_profile'
);
delete from acs_permissions where grantee_id in (
select object_id from acs_objects where object_type = 'im_profile'
);
delete from group_element_index where element_id in (
select object_id from acs_objects where object_type='im_profile'
);
delete from groups where group_id in (
select object_id from acs_objects where object_type='im_profile'
);
delete from parties where party_id in (
select object_id from acs_objects where object_type='im_profile'
);
delete from group_type_rels where group_type = 'im_profile'; delete from group_type_rels where group_type = 'im_profile';
drop table im_profiles; drop table im_profiles;
delete from acs_objects where object_type = 'im_profile';
delete from group_types where group_type = 'im_profile'; delete from group_types where group_type = 'im_profile';
drop package im_profile; drop package im_profile;
BEGIN BEGIN
...@@ -145,8 +189,9 @@ END; ...@@ -145,8 +189,9 @@ END;
/ /
commit; commit;
begin begin
acs_privilege.drop_privilege('view');
acs_privilege.drop_privilege('add_customers'); acs_privilege.drop_privilege('add_customers');
acs_privilege.drop_privilege('view_customers'); acs_privilege.drop_privilege('view_customers');
acs_privilege.drop_privilege('view_customers_all'); acs_privilege.drop_privilege('view_customers_all');
...@@ -165,6 +210,13 @@ end; ...@@ -165,6 +210,13 @@ end;
commit; commit;
begin
acs_privilege.drop_privilege('view');
end;
/
----------------------------------------------------------- -----------------------------------------------------------
-- Components -- Components
-- --
...@@ -206,19 +258,16 @@ drop function im_first_letter_default_to_a; ...@@ -206,19 +258,16 @@ drop function im_first_letter_default_to_a;
-- Projects -- Projects
-- --
-- Drop the "Internal Project"
DECLARE
v_internal_project_id integer;
BEGIN
select project_id
into v_internal_project_id
from im_projects
where project_path = 'internal';
im_project.del(v_internal_project_id); begin
END; for row in (
select project_id
from im_projects
) loop
im_project.del(row.project_id);
end loop;
end;
/ /
commit;
drop package im_project; drop package im_project;
...@@ -237,21 +286,17 @@ commit; ...@@ -237,21 +286,17 @@ commit;
-- Customers -- Customers
-- --
-- Test delete of a know customer begin
DECLARE for row in (
v_internal_customer_id integer; select customer_id
BEGIN from im_customers
select customer_id ) loop
into v_internal_customer_id im_customer.del(row.customer_id);
from im_customers end loop;
where customer_path = 'internal'; end;
im_customer.del(v_internal_customer_id);
END;
/ /
commit; commit;
-- Remove all possible links to customers from offices -- Remove all possible links to customers from offices
BEGIN BEGIN
update im_offices update im_offices
...@@ -290,9 +335,15 @@ commit; ...@@ -290,9 +335,15 @@ commit;
------------------------------------------------------- -------------------------------------------------------
-- P/O Business Objects -- P/O Business Objects
BEGIN
acs_rel_type.drop_type('im_biz_object_member');
END;
/
drop table im_member_rels; drop table im_member_rels;
drop package im_member_rel; drop package im_member_rel;
drop table im_biz_object_urls;
drop table im_biz_object_role_map; drop table im_biz_object_role_map;
drop table im_biz_object_members; drop table im_biz_object_members;
drop package im_biz_object; drop package im_biz_object;
...@@ -309,23 +360,6 @@ END; ...@@ -309,23 +360,6 @@ END;
commit; commit;
-----------------------------------------------------------
-- Permissions
begin
im_drop_profile ('P/O Admins');
im_drop_profile ('Customers');
im_drop_profile ('Offices');
im_drop_profile ('Employees');
im_drop_profile ('Freelancers');
im_drop_profile ('Project Managers');
im_drop_profile ('Senior Managers');
im_drop_profile ('Accounting');
end;
/
commit;
------------------------------------------------------- -------------------------------------------------------
-- Users -- Users
drop table users_contact; drop table users_contact;
......
...@@ -35,7 +35,7 @@ begin ...@@ -35,7 +35,7 @@ begin
); );
end; end;
/ /
show errors show errors;
create table im_projects ( create table im_projects (
...@@ -87,17 +87,19 @@ create table im_projects ( ...@@ -87,17 +87,19 @@ create table im_projects (
requires_report_p char(1) default('t') requires_report_p char(1) default('t')
constraint im_project_requires_report_p constraint im_project_requires_report_p
check (requires_report_p in ('t','f')), check (requires_report_p in ('t','f')),
project_budget number(12,2), project_budget number(12,2)
-- Don't allow the same name for the same customer+level
constraint im_projects_name_un
unique(project_name, customer_id, parent_id)
); );
create index im_project_parent_id_idx on im_projects(parent_id); create index im_project_parent_id_idx on im_projects(parent_id);
-- create index im_project_status_id_idx on im_projects(project_status_id); -- create index im_project_status_id_idx on im_projects(project_status_id);
-- create index im_project_project_nr_idx on im_projects(project_nr); -- create index im_project_project_nr_idx on im_projects(project_nr);
-- Dont allow the same name for the same customer+level
alter table im_projects add
constraint im_projects_name_un
unique(project_name, customer_id, parent_id);
-- ------------------------------------------------------------ -- ------------------------------------------------------------
......
...@@ -116,7 +116,7 @@ insert into im_views (view_id, view_name, visible_for) values (81, 'office_view' ...@@ -116,7 +116,7 @@ insert into im_views (view_id, view_name, visible_for) values (81, 'office_view'
-- Project Status List Page prompt Project Status List Page
-- --
delete from im_view_columns where column_id > 2200 and column_id < 2299; delete from im_view_columns where column_id > 2200 and column_id < 2299;
-- --
...@@ -161,7 +161,7 @@ commit; ...@@ -161,7 +161,7 @@ commit;
-- Project List Page prompt Project List Page
-- --
delete from im_view_columns where column_id > 2000 and column_id < 2099; delete from im_view_columns where column_id > 2000 and column_id < 2099;
-- --
...@@ -202,41 +202,47 @@ extra_select, extra_where, sort_order, visible_for) values (2021,20,NULL,'Status ...@@ -202,41 +202,47 @@ extra_select, extra_where, sort_order, visible_for) values (2021,20,NULL,'Status
commit; commit;
-- CustomerListPage columns. prompt CustomerListPage columns.
-- --
delete from im_view_columns where column_id > 0 and column_id < 8; delete from im_view_columns where column_id > 0 and column_id < 8;
-- --
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (1,1,NULL,'Client', extra_select, extra_where, sort_order, visible_for) values (1,1,NULL,'Client',
'"<A HREF=$customer_view_page?customer_id=$customer_id>$customer_name</A>"','','',1, '"<A HREF=$customer_view_page?customer_id=$customer_id>$customer_name</A>"','','',1,
'expr 1'); 'expr 1');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (3,1,NULL,'Type', extra_select, extra_where, sort_order, visible_for) values (3,1,NULL,'Type',
'$customer_type','','',2,'expr 1'); '$customer_type','','',2,'expr 1');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (4,1,NULL,'Status', extra_select, extra_where, sort_order, visible_for) values (4,1,NULL,'Status',
'$customer_status','','',3,'expr 1'); '$customer_status','','',3,'expr 1');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (5,1,NULL,'Contact', extra_select, extra_where, sort_order, visible_for) values (5,1,NULL,'Contact',
'"<A HREF=$user_view_page?user_id=$customer_contact_id>$customer_contact_name</A>"', '"<A HREF=$user_view_page?user_id=$customer_contact_id>$customer_contact_name</A>"',
'','',4,'im_permission $user_id view_customer_contacts'); '','',4,'im_permission $user_id view_customer_contacts');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (6,1,NULL,'Contact Email', extra_select, extra_where, sort_order, visible_for) values (6,1,NULL,'Contact Email',
'"<A HREF=mailto:$customer_contact_email>$customer_contact_email</A>"','','',5, '"<A HREF=mailto:$customer_contact_email>$customer_contact_email</A>"','','',5,
'im_permission $user_id view_customer_contacts'); 'im_permission $user_id view_customer_contacts');
-- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, -- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (7,1,NULL,'Contact Phone', -- extra_select, extra_where, sort_order, visible_for) values (7,1,NULL,'Contact Phone',
-- '$customer_phone','','',6,'im_permission $user_id view_customer_contact'); -- '$customer_phone','','',6,'im_permission $user_id view_customer_contact');
commit; commit;
-------------------------------------------------------------- --------------------------------------------------------------
-- UsersListPage prompt UsersListPage
-- --
delete from im_view_columns where column_id > 199 and column_id < 299; delete from im_view_columns where column_id > 199 and column_id < 299;
-- --
-- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, -- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (207,10,NULL,'#', -- extra_select, extra_where, sort_order, visible_for) values (207,10,NULL,'#',
-- '$user_id','','',6,''); -- '$user_id','','',6,'');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
...@@ -248,7 +254,7 @@ extra_select, extra_where, sort_order, visible_for) values (201,10,NULL,'Email', ...@@ -248,7 +254,7 @@ extra_select, extra_where, sort_order, visible_for) values (201,10,NULL,'Email',
'"<a href=mailto:$email>$email</a>"','','',3,''); '"<a href=mailto:$email>$email</a>"','','',3,'');
-- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, -- insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
extra_select, extra_where, sort_order, visible_for) values (202,10,NULL,'Status', -- extra_select, extra_where, sort_order, visible_for) values (202,10,NULL,'Status',
-- '$status','','',4,''); -- '$status','','',4,'');
insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl, insert into im_view_columns (column_id, view_id, group_id, column_name, column_render_tcl,
...@@ -274,7 +280,7 @@ commit; ...@@ -274,7 +280,7 @@ commit;
------------------------------------------------------------------- -------------------------------------------------------------------
-- UsersViewPage prompt UsersViewPage
-- --
delete from im_view_columns where column_id > 1100 and column_id <= 1199; delete from im_view_columns where column_id > 1100 and column_id <= 1199;
-- --
...@@ -294,7 +300,7 @@ commit; ...@@ -294,7 +300,7 @@ commit;
--------------------------------------------------------------- ---------------------------------------------------------------
-- UsersContactViewPage prompt UsersContactViewPage
-- --
delete from im_view_columns where column_id > 399 and column_id < 499; delete from im_view_columns where column_id > 399 and column_id < 499;
-- --
...@@ -361,7 +367,7 @@ commit; ...@@ -361,7 +367,7 @@ commit;
------------------------------------------------------------------- -------------------------------------------------------------------
-- UsersCommunityView prompt UsersCommunityView
-- --
delete from im_view_columns where column_id > 1300 and column_id <= 1399; delete from im_view_columns where column_id > 1300 and column_id <= 1399;
-- --
...@@ -389,7 +395,7 @@ commit; ...@@ -389,7 +395,7 @@ commit;
-- Offices -- Offices
-- --
-- OfficeListPage columns. prompt OfficeListPage columns.
-- --
delete from im_view_columns where column_id >= 8000 and column_id <= 8099; delete from im_view_columns where column_id >= 8000 and column_id <= 8099;
-- --
...@@ -421,7 +427,7 @@ extra_select, extra_where, sort_order, visible_for) values (8007,80,NULL,'Phone' ...@@ -421,7 +427,7 @@ extra_select, extra_where, sort_order, visible_for) values (8007,80,NULL,'Phone'
commit; commit;
-- OfficeViewPage columns. prompt OfficeViewPage columns.
-- --
delete from im_view_columns where column_id >= 8100 and column_id <= 8199; delete from im_view_columns where column_id >= 8100 and column_id <= 8199;
-- --
......
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