Index: openacs-4/packages/inventory-control/sql/postgresql/inventory-control-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/inventory-control/sql/postgresql/inventory-control-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/inventory-control/sql/postgresql/inventory-control-create.sql 3 Jul 2006 19:29:14 -0000 1.1 +++ openacs-4/packages/inventory-control/sql/postgresql/inventory-control-create.sql 8 Jul 2006 22:32:38 -0000 1.2 @@ -459,123 +459,7 @@ for each row execute procedure qci_ec_product_links_audit_tr (); --- comments made by users on the products -create table qci_ec_product_comments ( - comment_id integer not null primary key, - product_id integer not null references qci_ec_products, - user_id integer not null references users, - user_comment varchar(4000), - one_line_summary varchar(300), - rating numeric, - -- in some systems, the administrator will have to approve comments first - approved_p boolean, - comment_date timestamptz, - last_modified timestamptz not null, - last_modifying_user integer not null references users, - modified_ip_address varchar(20) not null -); -create index qci_ec_product_comments_idx on qci_ec_product_comments(product_id); -create index qci_ec_product_comments_idx2 on qci_ec_product_comments(user_id); -create index qci_ec_product_comments_idx3 on qci_ec_product_comments(approved_p); - -create table qci_ec_product_comments_audit ( - comment_id integer, - product_id integer, - user_id integer, - user_comment varchar(4000), - one_line_summary varchar(300), - rating numeric, - approved_p boolean, - last_modified timestamptz, - last_modifying_user integer, - modified_ip_address varchar(20), - delete_p boolean default 'f' -); - -create function qci_ec_product_comments_audit_tr () -returns opaque as ' -begin - insert into qci_ec_product_comments_audit ( - comment_id, product_id, user_id, - user_comment, one_line_summary, rating, approved_p, - last_modified, - last_modifying_user, modified_ip_address - ) values ( - old.comment_id, old.product_id, old.user_id, - old.user_comment, old.one_line_summary, old.rating, old.approved_p, - old.last_modified, - old.last_modifying_user, old.modified_ip_address - ); - return new; -end;' language 'plpgsql'; - -create trigger qci_ec_product_comments_audit_tr -after update or delete on qci_ec_product_comments -for each row execute procedure qci_ec_product_comments_audit_tr (); - - -create sequence qci_ec_product_review_id_seq start 1; -create view qci_ec_product_review_id_sequence as select nextval('qci_ec_product_review_id_seq') as nextval; - --- reviews made by professionals of the products -create table qci_ec_product_reviews ( - review_id integer not null primary key, - product_id integer not null references qci_ec_products, - author_name varchar(100), - publication varchar(100), - review_date timestamptz, - -- in HTML format - review text, - display_p boolean, - last_modified timestamptz not null, - last_modifying_user integer not null references users, - modified_ip_address varchar(20) not null -); - -create index qci_ec_product_reviews_idx on qci_ec_product_reviews (product_id); -create index qci_ec_product_reviews_idx2 on qci_ec_product_reviews (display_p); - -create table qci_ec_product_reviews_audit ( - review_id integer, - product_id integer, - author_name varchar(100), - publication varchar(100), - review_date timestamptz, - -- in HTML format - review text, - display_p boolean, - last_modified timestamptz, - last_modifying_user integer, - modified_ip_address varchar(20), - delete_p boolean default 'f' -); - -create function qci_ec_product_reviews_audit_tr () -returns opaque as ' -begin - insert into qci_ec_product_reviews_audit ( - review_id, product_id, - author_name, publication, review_date, - review, - display_p, - last_modified, - last_modifying_user, modified_ip_address - ) values ( - old.review_id, old.product_id, - old.author_name, old.publication, old.review_date, - old.review, - old.display_p, - old.last_modified, - old.last_modifying_user, old.modified_ip_address - ); - return new; -end;' language 'plpgsql'; - -create trigger qci_ec_product_reviews_audit_tr -after update or delete on qci_ec_product_reviews -for each row execute procedure qci_ec_product_reviews_audit_tr (); - -- I could in theory make some hairy system that lets them specify -- what kind of form element each field will have, does -- error checking, etc., but I don't think it's necessary since it's Index: openacs-4/packages/inventory-control/sql/postgresql/inventory-control-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/inventory-control/sql/postgresql/inventory-control-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/inventory-control/sql/postgresql/inventory-control-drop.sql 3 Jul 2006 19:29:14 -0000 1.1 +++ openacs-4/packages/inventory-control/sql/postgresql/inventory-control-drop.sql 8 Jul 2006 22:32:38 -0000 1.2 @@ -22,36 +22,9 @@ drop table qci_ec_custom_product_fields; -drop trigger qci_ec_product_reviews_audit_tr on qci_ec_product_reviews; -drop function qci_ec_product_reviews_audit_tr; -drop table qci_ec_product_reviews_audit; -drop index qci_ec_product_reviews_idx2 on qci_ec_product_reviews; -drop index qci_ec_product_reviews_idx on qci_ec_product_reviews; - -drop table qci_ec_product_reviews; - - -drop view qci_ec_product_review_id_sequence; -drop sequence qci_ec_product_review_id_seq; - - -drop trigger qci_ec_product_comments_audit_tr on qci_ec_product_comments; - -drop function qci_ec_product_comments_audit_tr (); - -drop table qci_ec_product_comments_audit (); - -drop index qci_ec_product_comments_idx3 on qci_ec_product_comments(); -drop index qci_ec_product_comments_idx2 on qci_ec_product_comments(); -drop index qci_ec_product_comments_idx on qci_ec_product_comments(); - -drop table qci_ec_product_comments (); - - - drop trigger qci_ec_product_links_audit_tr on qci_ec_product_links; drop function qci_ec_product_links_audit_tr ();