Index: openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql,v
diff -u -r1.8 -r1.9
--- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql	27 Feb 2004 01:13:15 -0000	1.8
+++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql	12 Mar 2004 04:54:04 -0000	1.9
@@ -38,9 +38,7 @@
     application                     varchar(100)
                                     constraint p_datasources_application_fk
                                     references apm_package_types (package_key)
-                                    on delete cascade
-                                    constraint p_datasources_application_nn
-                                    not null,
+                                    on delete cascade,
     owner                           varchar(100)
                                     constraint p_datasources_owner_fk
                                     references apm_package_types (package_key)
@@ -50,6 +48,12 @@
     template                        varchar(200)
                                     constraint p_datasources_template_nn
                                     not null,
+    admin_p                         char(1)
+                                    default 't'
+                                    constraint p_datasources_admin_p_nn
+                                    not null
+                                    constraint p_datasources_admin_p_ck
+                                    check (admin_p in ('t', 'f')),
     shadeable_p                     char(1)
                                     default 't'
                                     constraint p_datasources_shadeable_p_nn
@@ -100,6 +104,15 @@
     path, portlet templates go in the standard package template library directory.
 ';
 
+comment on column portal_datasources.admin_p is '
+    If true, this is a package admin datasource that should only be made available
+    to admins.  This only determines how the portal package code chooses to handle
+    a portal datasource when it creates portal pages and creates portlets.  An
+    admin portlet is responsible for ensuring that a user actually has the proper
+    privileges to admin its related application.  And applications that create their
+    own portal page structure (.LRN, in particular) may or may not honor this flag.
+';
+
 create table portal_datasource_parameters (
     datasource_id                   integer
                                     constraint p_ds_params_datasource_id_fk
@@ -254,9 +267,11 @@
                                     references acs_objects (object_id)
                                     constraint portals_pk
                                     primary key,
-    party_id                        integer
-                                    constraint p_party_id_fk
-                                    references parties (party_id),
+    owner_id                        integer
+                                    constraint p_owner_id_fk
+                                    references acs_objects (object_id)
+                                    constraint p_owner_id_nn
+                                    not null,
     package_id                      integer
                                     constraint p_package_id_fk
                                     references apm_packages (package_id)
@@ -276,7 +291,7 @@
                                     references portals (portal_id)
 );
 
-create index portals_party_id_idx on portals(party_id);
+create index portals_owner_id_idx on portals(owner_id);
 create index portals_package_id_idx on portals(package_id);
 
 comment on table portals is '
@@ -407,12 +422,6 @@
                                     not null
                                     constraint p_elements_hideable_p_ck
                                     check (hideable_p in ('t', 'f')),
-    application_id                  integer
-                                    constraint p_elements_application_id_fk
-                                    references apm_packages (package_id)
-                                    on delete cascade
-                                    constraint p_elements_application_id_nn
-                                    not null,
     constraint p_elements_page_id_name_un
     unique (page_id, name)
 );
@@ -432,11 +441,6 @@
     different behaviors based on a given elements state
 ';
 
-comment on column portal_elements.application_id is '
-    The package_id of the OpenACS application package instance this element interacts
-    with.
-';
-
 create table portal_element_parameters (
     parameter_id                    integer
                                     constraint portal_element_parameters_pk
