Index: openacs-4/packages/file-storage/file-storage.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v diff -u -r1.52 -r1.53 --- openacs-4/packages/file-storage/file-storage.info 29 Jan 2009 14:31:57 -0000 1.52 +++ openacs-4/packages/file-storage/file-storage.info 12 Oct 2009 22:46:16 -0000 1.53 @@ -7,7 +7,7 @@ f f - + OpenACS Collaborative document storage 2007-06-15 @@ -16,11 +16,11 @@ 0 #file-storage.file-storage# - - - + + + - + Index: openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 26 May 2005 08:28:44 -0000 1.20 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-create.sql 12 Oct 2009 22:46:16 -0000 1.21 @@ -36,9 +36,15 @@ primary key, -- the ID of the root folder -- JS: I removed the on delete cascade constraint on folder_id + -- DAVEB: I put it back. I have no idea what JS is referring to. + -- DAVEB: If you ever want to delete a root folder, say by deleting a + -- DAVEB: package instance of file-storage, you need this. + -- DAVEB: You DO have to delete all the folder contents and use CR pl/sql + -- DAVEB: procs to delete the folder, when you do that the on delete + -- DAVEB: cascade works fine. folder_id integer constraint fs_root_folder_folder_id_fk - references cr_folders + references cr_folders on delete cascade constraint fs_root_folder_folder_id_un unique ); @@ -48,6 +54,9 @@ -- To enable site-wide search to distinguish CR items as File Storage items -- we create an item subtype of content_item in the ACS Object Model +-- DAVEB: acs_object_types supports a null table name so we do that +-- instead of passing a false value so we can actually use the +-- content repository instead of duplicating all the code in file-storage set escape on declare @@ -58,8 +67,8 @@ pretty_name => 'File Storage Object', pretty_plural => 'File Storage Objects', supertype => 'content_revision', - table_name => 'fs_root_folders', - id_column => 'folder_id', + table_name => NULL, + id_column => NULL, name_method => 'file_storage.get_title' ); Index: openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-5.6.0d1-5.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-5.6.0d1-5.6.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-5.6.0d1-5.6.0d2.sql 12 Oct 2009 22:46:16 -0000 1.1 @@ -0,0 +1,26 @@ +-- Don't use a fake table name, acs_objects supports types that don't have +-- a type specific table +update acs_object_types set + table_name = NULL, + id_column = NULL +where + object_type = 'file_storage_object'; + +begin +content_type.refresh_view('file_storage_object'); +content_type.refresh_trigger('file_storage_object'); +end; +/ + +alter table + fs_root_folders +drop constraint + fs_root_folder_folder_id_fk; + +alter table + fs_root_folders +add constraint + fs_root_folder_folder_id_fk + foreign key (folder_id) + references cr_folders + on delete cascade; Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql,v diff -u -r1.22 -r1.23 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 26 May 2005 08:28:45 -0000 1.22 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-create.sql 12 Oct 2009 22:46:16 -0000 1.23 @@ -36,9 +36,15 @@ -- the ID of the root folder -- JS: I removed the on delete cascade constraint on folder_id -- JS: It is superfluous, and causes a lot of RI headaches + -- DAVEB: I put it back. I have no idea what JS is referring to. + -- DAVEB: If you ever want to delete a root folder, say by deleting a + -- DAVEB: package instance of file-storage, you need this. + -- DAVEB: You DO have to delete all the folder contents and use CR pl/sql + -- DAVEB: procs to delete the folder, when you do that the on delete + -- DAVEB: cascade works fine. folder_id integer constraint fs_root_folder_folder_id_fk - references cr_folders + references cr_folders on delete cascade constraint fs_root_folder_folder_id_un unique ); @@ -52,8 +58,11 @@ -- first, before item metadata 'File Storage Object', -- pretty_name 'File Storage Objects', -- pretty_plural - 'fs_root_folders', -- table_name - 'folder_id', -- id_column + NULL, -- table_name + -- DAVEB: acs_object_types supports a null table name so we do that + -- instead of passing a false value so we can actually use the + -- content repository instead of duplicating all the code in file-storage + NULL, -- id_column 'file_storage__get_title' -- name_method ); Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql 12 Oct 2009 22:46:16 -0000 1.1 @@ -0,0 +1,22 @@ +-- Don't use a fake table name, acs_objects supports types that don't have +-- a type specific table +update acs_object_types set + table_name = NULL, + id_column = NULL +where + object_type = 'file_storage_object'; +select content_type__refresh_view('file_storage_object'); +select content_type__refresh_trigger('file_storage_object'); + +alter table + fs_root_folders +drop constraint + fs_root_folder_folder_id_fk; + +alter table + fs_root_folders +add constraint + fs_root_folder_folder_id_fk + foreign key (folder_id) + references cr_folders + on delete cascade;