Index: openacs-4/packages/views/sql/postgresql/views-datamodel.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/views/sql/postgresql/views-datamodel.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/views/sql/postgresql/views-datamodel.sql 23 Jul 2007 05:25:09 -0000 1.2 +++ openacs-4/packages/views/sql/postgresql/views-datamodel.sql 1 Aug 2007 08:59:56 -0000 1.3 @@ -12,7 +12,7 @@ -- License. Full text of the license is available from the GNU Project: -- http://www.fsf.org/copyleft/gpl.html -create table views ( +create table views_views ( object_id integer constraint views_object_id_fk references acs_objects(object_id) on delete cascade @@ -23,15 +23,15 @@ references parties(party_id) on delete cascade constraint views_viewer_id_nn not null, - views integer default 1, + views_count integer default 1, last_viewed timestamptz default now(), - constraint views_pk + constraint views_views_pk primary key (object_id, viewer_id) ); -create unique index views_viewer_idx on views(viewer_id, object_id); +create unique index views_views_viewer_idx on views_views(viewer_id, object_id); -comment on table views is ' +comment on table views_views is ' a simple count of how many times an object is viewed. '; @@ -43,7 +43,7 @@ not null constraint view_aggregatess_pk primary key, - views integer default 1, + views_count integer default 1, unique_views integer default 1, last_viewed timestamptz default now() ); @@ -64,31 +64,31 @@ references parties(party_id) on delete cascade constraint views_by_type_viewer_id_nn not null, - type varchar(100) not null, - views integer default 1, + view_type varchar(100) not null, + views_count integer default 1, last_viewed timestamptz default now(), constraint views_by_type_pk - primary key (object_id, viewer_id, type) + primary key (object_id, viewer_id, view_type) ); -create unique index views_by_type_viewer_idx on views_by_type(viewer_id, object_id, type); +create unique index views_by_type_viewer_idx on views_by_type(viewer_id, object_id, view_type); comment on table views_by_type is ' a simple count of how many times an object is viewed for each type. '; create table view_aggregates_by_type ( object_id integer - constraint view_aggregates_by_type_object_id_fk + constraint view_agg_b_type_ob_id_fk references acs_objects(object_id) on delete cascade - constraint view_aggregates_by_type_object_id_nn + constraint view_agg_b_type_ob_id_nn not null, - type varchar(100) not null, - views integer default 1, + view_type varchar(100) not null, + views_count integer default 1, unique_views integer default 1, last_viewed timestamptz default now(), constraint view_aggregates_by_type_pk - primary key (object_id, type) + primary key (object_id, view_type) ); comment on table view_aggregates_by_type is '