Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -6,11 +6,13 @@ -- create table bulk_mail_messages ( - bulk_mail_id constraint bm_messages_bulk_mail_id_fk + bulk_mail_id integer + constraint bm_messages_bulk_mail_id_fk references acs_objects (object_id) constraint bm_messages_bulk_mail_id_pk primary key, - package_id constraint bm_messages_package_id_fk + package_id integer + constraint bm_messages_package_id_fk references apm_packages (package_id) constraint bm_messages_package_id_nn not null, @@ -28,7 +30,7 @@ subject varchar(4000), reply_to varchar(4000), extra_headers varchar(4000), - message clob + message text constraint bm_messages_message_nn not null, query varchar(4000) @@ -37,20 +39,28 @@ ); -- create a new object type +create function inline_0 () +returns integer as ' begin - acs_object_type__create_type( - 'acs_object', - 'bulk_mail_message', - 'Bulk Mail Message', - 'Bulk Mail Messages', - 'bulk_mail_messages', - 'bulk_mail_id', - 'bulk_mail', - 'acs_object__default_name' + perform acs_object_type__create_type( + ''bulk_mail_message'', + ''Bulk Mail Message'', + ''Bulk Mail Messages'', + ''acs_object'', + ''bulk_mail_messages'', + ''bulk_mail_id'', + ''bulk_mail'', + ''f'', + null, + ''acs_object__default_name'' ); -end; -/ -show errors + return null; +end;' language 'plpgsql'; + +select inline_0(); + +drop function inline_0 (); + \i bulk-mail-views-create.sql \i bulk-mail-package-create.sql Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-drop.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-drop.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -5,20 +5,26 @@ -- @version $Id$ -- +create function inline_0 () +returns integer as' +declare + row RECORD; begin - for row in (select bulk_mail_id from bulk_mail_messages) loop - bulk_mail__delete(row.bulk_mail_id); + + for row in select bulk_mail_id from bulk_mail_messages loop + perform bulk_mail__delete(row.bulk_mail_id); end loop; -end; -/ -show errors -begin - acs_object_type__drop_type('bulk_mail_message', 'f'); -end; -/ -show errors + perform acs_object_type__drop_type(''bulk_mail_message'', ''f''); + return null; + +end;' language 'plpgsql'; + +select inline_0(); + +drop function inline_0 (); + \i bulk-mail-package-drop.sql \i bulk-mail-views-drop.sql Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -5,7 +5,6 @@ -- @version $Id$ -- -drop function bulk_mail__new; create function bulk_mail__new (integer, integer, varchar, varchar, varchar, varchar, varchar, varchar, varchar, text, varchar, timestamp, integer, varchar, integer) returns integer as ' declare @@ -68,7 +67,6 @@ end; ' language 'plpgsql'; -drop function bulk_mail__delete; create function bulk_mail__delete (integer) returns integer as ' declare @@ -79,7 +77,7 @@ from bulk_mail_messages where bulk_mail_messages.bulk_mail_id = bulk_mail__delete__bulk_mail_id; - acs_object__delete(bulk_mail__delete__bulk_mail_id); + perform acs_object__delete(bulk_mail__delete__bulk_mail_id); end; ' language 'plpgsql'; Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-drop.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-drop.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -5,5 +5,5 @@ -- @version $Id$ -- -drop function bulk_mail__new; -drop function bulk_mail__delete; +drop function bulk_mail__new (integer, integer, varchar, varchar, varchar, varchar, varchar, varchar, varchar, text, varchar, timestamp, integer, varchar, integer); +drop function bulk_mail__delete (integer); Index: openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 4 Jun 2002 22:53:50 -0000 1.2 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 12 Jun 2002 13:53:13 -0000 1.3 @@ -12,7 +12,8 @@ -- intervals should really be service contracts so other intervals can be -- taken into account. For now we're going to make them just intervals create table notification_intervals ( - interval_id constraint notif_interv_id_fk + interval_id integer + constraint notif_interv_id_fk references acs_objects (object_id) constraint notif_interv_id_pk primary key, @@ -29,7 +30,8 @@ -- delivery methods should be service contracts, too. create table notification_delivery_methods ( - delivery_method_id constraint notif_deliv_meth_fk + delivery_method_id integer + constraint notif_deliv_meth_fk references acs_objects (object_id) constraint notif_deliv_meth_pk primary key, @@ -43,7 +45,8 @@ ); create table notification_types ( - type_id constraint notif_type_type_id_fk + type_id integer + constraint notif_type_type_id_fk references acs_objects (object_id) constraint notif_type_type_id_pk primary key, @@ -60,37 +63,45 @@ -- what's allowed for a given notification type? create table notification_types_intervals ( - type_id constraint notif_type_int_type_id_fk + type_id integer + constraint notif_type_int_type_id_fk references notification_types (type_id), - interval_id constraint notif_type_int_int_id_fk + interval_id integer + constraint notif_type_int_int_id_fk references notification_intervals (interval_id), constraint notif_type_int_pk primary key (type_id, interval_id) ); -- allowed delivery methods create table notification_types_del_methods ( - type_id constraint notif_type_del_type_id_fk + type_id integer + constraint notif_type_del_type_id_fk references notification_types (type_id), - delivery_method_id constraint notif_type_del_meth_id_fk + delivery_method_id integer + constraint notif_type_del_meth_id_fk references notification_delivery_methods (delivery_method_id), constraint notif_type_deliv_pk primary key (type_id, delivery_method_id) ); -- Requests for Notifications create table notification_requests ( - request_id constraint notif_request_id_fk + request_id integer + constraint notif_request_id_fk references acs_objects (object_id) constraint notif_request_id_pk primary key, - type_id constraint notif_request_type_id_fk + type_id integer + constraint notif_request_type_id_fk references notification_types (type_id), - user_id constraint notif_request_user_id_fk + user_id integer + constraint notif_request_user_id_fk references users (user_id) on delete cascade, -- The object this request pertains to - object_id constraint notif_request_object_id_fk + object_id integer + constraint notif_request_object_id_fk references acs_objects (object_id) on delete cascade, -- the interval must be allowed for this type @@ -122,21 +133,25 @@ -- the actual stuff that has to go out create table notifications ( - notification_id constraint notif_notif_id_fk + notification_id integer + constraint notif_notif_id_fk references acs_objects (object_id) constraint notif_notif_id_pk primary key, - type_id constraint notif_type_id_fk + type_id integer + constraint notif_type_id_fk references notification_types(type_id), -- the object this notification pertains to - object_id constraint notif_object_id_fk + object_id integer + constraint notif_object_id_fk references acs_objects(object_id) on delete cascade, notif_date timestamp constraint notif_notif_date_nn not null, -- this is to allow responses to notifications - response_id constraint notif_reponse_id_fk + response_id integer + constraint notif_reponse_id_fk references acs_objects (object_id), notif_subject varchar(100), notif_text text, @@ -145,10 +160,12 @@ -- who has received this notification? create table notification_user_map ( - notification_id constraint notif_user_map_notif_id_fk + notification_id integer + constraint notif_user_map_notif_id_fk references notifications (notification_id) on delete cascade, - user_id constraint notif_user_map_user_id_fk + user_id integer + constraint notif_user_map_user_id_fk references users(user_id) on delete cascade, constraint notif_user_map_pk @@ -159,66 +176,78 @@ -- -- Object Types -- +create function inline_0 () +returns integer as ' begin - select acs_object_type__create_type( - 'acs_object', - 'notification_interval', - 'Notification Interval', - 'Notification Intervals', - 'notification_intervals', - 'interval_id', - 'notification_interval', + perform acs_object_type__create_type( + ''notification_interval'', + ''Notification Interval'', + ''Notification Intervals'', + ''acs_object'', + ''notification_intervals'', + ''interval_id'', + ''notification_interval'', + ''f'', null, null ); - select acs_object_type__create_type( - 'acs_object', - 'notification_delivery_method', - 'Notification Delivery Method', - 'Notification Delivery Methods', - 'notification_delivery_methods', - 'delivery_method_id', - 'notification_delivery_method', + perform acs_object_type__create_type( + ''notification_delivery_method'', + ''Notification Delivery Method'', + ''Notification Delivery Methods'', + ''acs_object'', + ''notification_delivery_methods'', + ''delivery_method_id'', + ''notification_delivery_method'', + ''f'', null, null ); - select acs_object_type__create_type( - 'acs_object', - 'notification_type', - 'Notification Type', - 'Notification Types', - 'notification_types', - 'type_id', - 'notification_type', + perform acs_object_type__create_type( + ''notification_type'', + ''Notification Type'', + ''Notification Types'', + ''acs_object'', + ''notification_types'', + ''type_id'', + ''notification_type'', + ''f'', null, null ); - select acs_object_type__create_type( - 'acs_object', - 'notification_request', - 'Notification Request', - 'Notification Requests', - 'notification_requests', - 'request_id', - 'notification_request', + perform acs_object_type__create_type( + ''notification_request'', + ''Notification Request'', + ''Notification Requests'', + ''acs_object'', + ''notification_requests'', + ''request_id'', + ''notification_request'', + ''f'', null, null ); - select acs_object_type__create_type( - 'acs_object', - 'notification', - 'Notification', - 'Notifications', - 'notifications', - 'notification_id', - 'notification', + perform acs_object_type__create_type( + ''notification'', + ''Notification'', + ''Notifications'', + ''acs_object'', + ''notifications'', + ''notification_id'', + ''notification'', + ''f'', null, null ); -end; + return null; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/notifications/sql/postgresql/notifications-core-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-core-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-drop.sql 1 Jun 2002 19:04:45 -0000 1.1 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-drop.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -1,4 +1,3 @@ - -- -- The Notifications Package -- @@ -8,50 +7,42 @@ -- GNU GPL v2 -- --- drop script - drop table notification_user_map; - drop table notifications; - drop table notification_requests; - drop table notification_types_del_methods; - drop table notification_types_intervals; - drop table notification_types; - drop table notification_intervals; - drop table notification_delivery_methods; +create function inline_0 () +returns integer as ' +begin + perform acs_object_type__drop_type( + ''notification_interval'', ''f'' + ); + perform acs_object_type__drop_type( + ''notification_delivery_method'', ''f'' + ); --- --- Object Types --- + perform acs_object_type__drop_type( + ''notification_type'', ''f'' + ); -begin + perform acs_object_type__drop_type( + ''notification_request'', ''f'' + ); - select acs_object_type__drop_type ( - 'notification_interval', 'f' - ); + perform acs_object_type__drop_type( + ''notification'', ''f'' + ); - select acs_object_type__drop_type ( - 'notification_delivery_method', 'f' - ); + return null; - select acs_object_type__drop_type ( - 'notification_type', 'f' - ); +end;' language 'plpgsql'; - select acs_object_type__drop_type ( - 'notification_request', 'f' - ); - - select acs_object_type__drop_type ( - 'notification', 'f' - ); -end; +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/notifications/sql/postgresql/notifications-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 1 Jun 2002 19:04:45 -0000 1.1 +++ openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -1,4 +1,3 @@ - -- -- The Notifications Package -- Index: openacs-4/packages/notifications/sql/postgresql/notifications-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notifications-drop.sql 12 Jun 2002 13:53:13 -0000 1.1 @@ -0,0 +1,15 @@ +-- +-- The Notifications Package +-- +-- ben@openforce.net +-- Copyright OpenForce, 2002. +-- +-- GNU GPL v2 +-- + +-- the service contracts will eventually be created +-- @ notifications-interval-sc-drop.sql +-- @ notifications-delivery-sc-drop.sql + +\i notifications-package-drop.sql +\i notifications-core-drop.sql Index: openacs-4/packages/notifications/sql/postgresql/notifications-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-init.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/notifications/sql/postgresql/notifications-init.sql 1 Jun 2002 19:04:45 -0000 1.1 +++ openacs-4/packages/notifications/sql/postgresql/notifications-init.sql 12 Jun 2002 13:53:13 -0000 1.2 @@ -9,45 +9,53 @@ -- -- initialize some stuff +create function inline_0 () +returns integer as ' begin - select notification_interval__new ( - NULL, - 'daily', - 3600 * 24, - now(), - NULL, - NULL, - NULL - ); - select notification_interval__new ( - NULL, - 'hourly', - 3600, - now(), - NULL, - NULL, - NULL - ); + perform notification_interval__new ( + null, + ''daily'', + 3600 * 24, + now(), + null, + null, + null + ); - select notification_interval__new ( - NULL, - 'instant', - 0, - now(), - NULL, - NULL, - NULL - ); + perform notification_interval__new ( + null, + ''hourly'', + 3600, + now(), + null, + null, + null + ); + + perform notification_interval__new ( + null, + ''instant'', + 0, + now(), + null, + null, + null + ); - select notification_delivery_method__new ( - NULL, - 'email', - 'Email', - now(), - NULL, - NULL, - NULL - ); + perform notification_delivery_method__new ( + null, + ''email'', + ''Email'', + now(), + null, + null, + null + ); -end; + return null; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0 ();