Index: openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql	20 Mar 2001 22:51:55 -0000	1.1
+++ openacs-4/packages/acs-kernel/sql/oracle/apm-create.sql	5 Apr 2001 18:23:38 -0000	1.2
@@ -508,22 +508,44 @@
   insert into apm_package_file_types(file_type_key, pretty_name) values('documentation', 'Documentation');
   insert into apm_package_file_types(file_type_key, pretty_name) values('tcl_procs', 'Tcl procedure library');
   insert into apm_package_file_types(file_type_key, pretty_name) values('tcl_init', 'Tcl initialization');
+  insert into apm_package_file_types(file_type_key, pretty_name) values('tcl_util', 'Tcl utility script');
   insert into apm_package_file_types(file_type_key, pretty_name) values('content_page', 'Content page');
   insert into apm_package_file_types(file_type_key, pretty_name) values('package_spec', 'Package specification');
   insert into apm_package_file_types(file_type_key, pretty_name) values('data_model', 'Data model');
   insert into apm_package_file_types(file_type_key, pretty_name) values('data_model_create', 'Data model installation');
   insert into apm_package_file_types(file_type_key, pretty_name) values('data_model_drop', 'Data model deinstallation');
   insert into apm_package_file_types(file_type_key, pretty_name) values('data_model_upgrade', 'Data model upgrade');
-  insert into apm_package_file_types(file_type_key, pretty_name) values('java_code', 'Java Code');
+  insert into apm_package_file_types(file_type_key, pretty_name) values('java_code', 'Java code');
+  insert into apm_package_file_types(file_type_key, pretty_name) values('java_archive', 'Java archive');
+  insert into apm_package_file_types(file_type_key, pretty_name) values('query_file', 'Query file');
   insert into apm_package_file_types(file_type_key, pretty_name) values('template', 'Template file');
   insert into apm_package_file_types(file_type_key, pretty_name) values('shell', 'Shell utility');
-  insert into apm_package_file_types(file_type_key, pretty_name) values('sqlj_code', 'SQLJ Library');
+  insert into apm_package_file_types(file_type_key, pretty_name) values('sqlj_code', 'SQLJ library');
   commit;
 end;
 /
 show errors
 
+create table apm_package_db_types (
+    db_type_key      varchar2(50)
+                       constraint apm_package_db_types_pk primary key,
+    pretty_db_name   varchar2(200)
+                       constraint apm_package_db_types_name_nn not null
+);
+
+comment on table apm_package_db_types is '
+  A list of all the different kinds of database engines that an APM package can
+  support.  This table is initialized in acs-tcl/tcl/apm-init.tcl rather than in
+  PL/SQL in order to guarantee that the list of supported database engines is
+  consistent between the bootstrap code and the package manager.
+';
+
 -- Which files are contained in a version?
+
+-- Files may be constrained to work only with a single database engine.  In practice only
+-- datamodel and query files should be so constrained.  If db_type is NULL the
+-- file is loaded no matter which supported database engine is installed.
+
 create table apm_package_files (
     file_id            integer
                        constraint apm_package_files_id_pk primary key,
@@ -533,10 +555,12 @@
     path               varchar2(1500)
                        constraint apm_package_files_path_nn not null,
     file_type          constraint apm_package_files_type_fk references apm_package_file_types,
+    db_type            constraint apm_package_files_db_type_fk references apm_package_db_types,
     constraint apm_package_files_un unique(version_id, path)
 );
 
 create bitmap index apm_pkg_files_file_type_idx on apm_package_files (file_type);
+create bitmap index apm_pkg_files_db_type_idx on apm_package_files (db_type);
 
 comment on table apm_package_files is '
   The files that belong to an APM package.  We store this information in the database
@@ -553,6 +577,9 @@
   What kind of file is it?
 ';
 
+comment on column apm_package_files.db_type is '
+    If not null, which database engine does this file support?
+';
 
 create index apm_package_files_by_path on apm_package_files(path);
 create index apm_package_files_by_version on apm_package_files(version_id);
@@ -1121,7 +1148,9 @@
 				default null,
     version_id			in apm_package_versions.version_id%TYPE,
     path			in apm_package_files.path%TYPE,
-    file_type			in apm_package_file_types.file_type_key%TYPE
+    file_type			in apm_package_file_types.file_type_key%TYPE,
+    db_type			in apm_package_db_types.db_type_key%TYPE
+                                default null
   ) return apm_package_files.file_id%TYPE;
 
   -- Remove a file from the indicated version.
@@ -2090,7 +2119,9 @@
 				default null,
     version_id			in apm_package_versions.version_id%TYPE,
     path			in apm_package_files.path%TYPE,
-    file_type			in apm_package_file_types.file_type_key%TYPE
+    file_type			in apm_package_file_types.file_type_key%TYPE,
+    db_type			in apm_package_db_types.db_type_key%TYPE
+                                default null
   ) return apm_package_files.file_id%TYPE
   is
     v_file_id apm_package_files.file_id%TYPE;
@@ -2110,9 +2141,10 @@
 	        end if;
 
   	        insert into apm_package_files 
-		(file_id, version_id, path, file_type) 
+		(file_id, version_id, path, file_type, db_type) 
 		values 
-		(v_file_id, add_file.version_id, add_file.path, add_file.file_type);
+		(v_file_id, add_file.version_id, add_file.path, add_file.file_type,
+                 add_file.db_type);
 	        return v_file_id;
      end add_file;
 
