[ic] address book: delete & expand fields

marc.brevoort interchange-users@icdevgroup.org
Tue Sep 3 12:07:02 2002


On Tuesday 03 September 2002 16:44, you wrote:
> 2 questions about the address book:
>
> 1. How can I add more fields to the ones allready there, i need a company_2
> and a phone_night to be in the address book.

Note that the address book (table userdb) already contains a 
phone_night column. 

Of course after adding the columns, someone will come along who will need 
a company_3 and phone_emergency or phone_mobile, phone_beeper or 
whatever. 

But let's assume this will never happen.
The following way will probably work.

Just in case, you can save your old data with 

	mysqldump databasename >dumpfile

and later restore it with

	mysql databasename <dumpfile

After taking precautions to make sure you can restore the old situation,
edit file
	/var/lib/interchange/storename/dbconf/mysql/userdb.mysql 

Add the columns that you want to add.

After that use mysql to edit the database. You can add the two 
columns, e.g. with

	ALTER TABLE ADD COLUMN COMPANY_2 char(30);
(and similar for the phone number).

After that, quit mysql and restart the interchange server, it should recognize
the new table layout for the store.

> 2. How can I delete adresses from the address book. Using mysql I dont know
> how since it is no table but a filed in a table column. 

Not really an interchange question, but an SQL question; probably you can
do what you want by clearing the address column, 

	update userdb set column='' where code=' (user ID)  '

If you want to drop the entire column from the table use 

	drop column column_name

If you need to, wrap this in a query tag.

Regards,

Marc Brevoort