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.6 -r1.7
--- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql	29 Jan 2004 03:50:59 -0000	1.6
+++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql	1 Feb 2004 03:08:10 -0000	1.7
@@ -257,6 +257,11 @@
     party_id                        integer
                                     constraint p_party_id_fk
                                     references parties (party_id),
+    package_id                      integer
+                                    constraint p_package_id_fk
+                                    references apm_packages (package_id)
+                                    constraint p_package_id_nn
+                                    not null,
     name                            varchar(200)
                                     default 'Untitled'
                                     constraint p_name_nn
@@ -272,30 +277,41 @@
 );
 
 create index portals_party_id_idx on portals(party_id);
+create index portals_package_id_idx on portals(package_id);
 
 comment on table portals is '
     portals are containers of one or more portal pages mapped to a party.
 ';
 
+comment on column portals.package_id is '
+    The portal instance that ownns this portal
+';
+
 comment on column portals.template_id is '
-    a portal may have a template (another portal)
+    A portal may have a template (another portal)
 ';
 
 comment on column portals.theme_id is '
-    portals one theme for all its contained pages
+    Portals one theme for all its contained pages
 ';
 
 create table portal_datasource_map (
     package_id                      integer
                                     constraint pdm_package_id_fk
-                                    references apm_packages (package_id),
+                                    references apm_packages (package_id)
+                                    constraint pdm_package_id_nn
+                                    not null,
     datasource_id                   integer
                                     constraint pdm_datasource_id_fk
-                                    references portal_datasources (datasource_id),
+                                    references portal_datasources (datasource_id)
+                                    constraint pdm_datasource_id_nn
+                                    not null,
     constraint pdm_pk
     primary key (package_id, datasource_id)
 );
 
+create index pdm_datasource_idx on portal_datasource_map (datasource_id);
+
 comment on table portal_datasource_map is '
     Maps datasources to portal instances.  This is used by the portal admin UI to track
     which datasources have had their applications mounted under the instance''s mount
