Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql 20 Jan 2021 21:01:03 -0000 1.2 @@ -1,5 +1,7 @@ -- @cvs-id: $Id$ +select acs_object_type__drop_type('cn_address', TRUE); + create function inline_0 () returns integer as ' begin Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses.sql 20 Jan 2021 21:01:03 -0000 1.2 @@ -1,6 +1,9 @@ -- @cvs-id: $Id$ --- lookup table +-- lookup table + +DROP TABLE IF EXISTS cn_address_types CASCADE; + create table cn_address_types ( address_type_id integer @@ -13,7 +16,7 @@ -- main table -create table cn_addresses +create table IF NOT EXISTS cn_addresses ( address_id integer constraint cn_addresses_address_id_pk @@ -67,10 +70,10 @@ This is a foreign key link into address_types. '; -insert into cn_address_types values (acs_object_id_seq.nextval,'Primary Business'); -insert into cn_address_types values (acs_object_id_seq.nextval,'Primary Home'); -insert into cn_address_types values (acs_object_id_seq.nextval,'Mailing'); -insert into cn_address_types values (acs_object_id_seq.nextval,'Primary Business'); +insert into cn_address_types values (nextval('t_acs_attribute_id_seq'), 'Primary Business'); +insert into cn_address_types values (nextval('t_acs_attribute_id_seq'), 'Primary Home'); +insert into cn_address_types values (nextval('t_acs_attribute_id_seq'), 'Mailing'); +insert into cn_address_types values (nextval('t_acs_attribute_id_seq'), 'Primary Business'); -- plsql Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql 20 Jan 2021 21:01:03 -0000 1.2 @@ -1,5 +1,6 @@ -- @cvs-id: $Id$ +select acs_object_type__drop_type('cn_phone_number', TRUE); create function inline_0 () returns integer as ' @@ -16,7 +17,6 @@ null, -- type_extension_table null -- name_method ); - return 0; end;' language 'plpgsql'; @@ -90,7 +90,7 @@ p_phone_number alias for $2; -- default p_phone_number_id alias for $3; -- default p_phone_type_id alias for $4; -- default - p_best_contact_time alias for $5;_ + p_best_contact_time alias for $5; v_return integer := 0; begin Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-phones.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-phones.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-phones.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-phones.sql 20 Jan 2021 21:01:04 -0000 1.2 @@ -1,6 +1,8 @@ -- @cvs-id: $Id$ -create table cn_phone_types ( +DROP TABLE IF EXISTS cn_phone_types CASCADE; + +create table IF NOT EXISTS cn_phone_types ( phone_type_id integer constraint cn_phone_types_id_pk primary key, @@ -9,13 +11,13 @@ not null ); -insert into cn_phone_types values (acs_object_id_seq.nextval,'Business - Primary'); -insert into cn_phone_types values (acs_object_id_seq.nextval,'Business - Fax'); -insert into cn_phone_types values (acs_object_id_seq.nextval,'Cellular'); -insert into cn_phone_types values (acs_object_id_seq.nextval,'Pager'); +insert into cn_phone_types values (nextval('t_acs_attribute_id_seq'), 'Business - Primary'); +insert into cn_phone_types values (nextval('t_acs_attribute_id_seq'), 'Business - Fax'); +insert into cn_phone_types values (nextval('t_acs_attribute_id_seq'), 'Cellular'); +insert into cn_phone_types values (nextval('t_acs_attribute_id_seq'), 'Pager'); -create table cn_phone_numbers +create table IF NOT EXISTS cn_phone_numbers ( phone_number_id integer constraint cn_phone_number_id_pk Index: openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql 20 Jan 2021 21:01:04 -0000 1.2 @@ -4,6 +4,7 @@ -- To disable simply change permissions or move pages to admin/ -- Create an acs_object type +select acs_object_type__drop_type('contact_category', TRUE); select acs_object_type__create_type ( 'contact_category', 'Contact Category', @@ -17,7 +18,9 @@ 'acs_object__default_name' ); -create table contact_categories +DROP TABLE IF EXISTS contact_categories CASCADE; + +create table IF NOT EXISTS contact_categories ( category_id integer constraint contact_categories_id_pk @@ -30,14 +33,14 @@ ); -insert into contact_categories values (acs_object_id_seq.nextval,'Agents'); -insert into contact_categories values (acs_object_id_seq.nextval,'Employees'); -insert into contact_categories values (acs_object_id_seq.nextval,'Supplier'); -insert into contact_categories values (acs_object_id_seq.nextval,'Customer'); +insert into contact_categories values (acs_object__new(null,'acs_object'), 'Agents'); +insert into contact_categories values (acs_object__new(null,'acs_object'), 'Employees'); +insert into contact_categories values (acs_object__new(null,'acs_object'), 'Supplier'); +insert into contact_categories values (acs_object__new(null,'acs_object'), 'Customer'); -- plsql -create function contact_category__new (integer,varchar,integer,varchar,integer) +create or replace function contact_category__new (integer,varchar,integer,varchar,integer) returns integer as ' declare p_category_id alias for $1; @@ -74,7 +77,7 @@ end;' language 'plpgsql'; -create function contact_category__del (integer) +create or replace function contact_category__del (integer) returns integer as ' declare p_category_id alias for $1; Index: openacs-4/packages/contacts-lite/sql/postgresql/contacts-lite-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contacts-lite-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/contacts-lite-create.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/contacts-lite-create.sql 20 Jan 2021 21:01:04 -0000 1.2 @@ -1,6 +1,6 @@ -- @cvs-id:$Id$ -create table cn_company_types ( +create table IF NOT EXISTS cn_company_types ( company_type_id integer constraint company_types_pk primary key, @@ -28,7 +28,7 @@ -- \i contact-category.sql -create table contacts ( +create table IF NOT EXISTS contacts ( contact_id integer constraint contacts_contact_id_pk primary key @@ -54,7 +54,7 @@ title varchar (100) ); -create index contacts_email_ix on contacts (email); +create index IF NOT EXISTS contacts_email_ix on contacts (email); comment on table contacts is ' This is the main table for contacts. Index: openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql 20 Jan 2021 21:01:04 -0000 1.2 @@ -1,5 +1,7 @@ -- @cvs-id: $Id$ +select acs_object_type__drop_type('contact', TRUE); + create function inline_0 () returns integer as ' begin @@ -23,7 +25,7 @@ drop function inline_0 (); -create function contact__new (varchar, varchar, varchar, varchar, varchar, +create or replace function contact__new (varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, integer, integer, text, varchar, varchar, integer,varchar,integer,integer) returns integer as ' declare