[ic] customizing IC's default SQL database tables

Dan B interchange-users@lists.akopia.com
Thu May 17 20:23:00 2001


Gabe,

At 03:46 PM 5/17/2001 -0700, you wrote:
>Thanks a lot for the advice, Dan. Two more things - what about making
>new database tables?

Same procedure (copied below), except you copy an existing .pgsql and edit 
it, instead of just adding one column.  Also you need to first CREATE TABLE 
of course, (instead of ALTER TABLE), and pgsql has great documentation 
(like a free book online in PDF).

>What about changing the default tables?

You should be able to make any changes that you are capable of with pgsql, 
and as long as those changes are reflected in the respective .pgsql file, 
Interchange will be fine.

>Can I just
>edit the .pgsql files?

Yep.

>Also, should I delete the .txt files in
>/products?

It's not really necessary to delete them.  As long as there is a .sql file 
(any length) then IC will utilize the SQL database instead of the text.

>And one more thing - how much can I change the databases
>without them breaking on me? I would like to implement table key ID's
>using database sequences.

Do you mean the SERIAL datatype in pgsql?  Or using pgsql's record OID?

Either way, I don't know if IC would stand in your way or not, but I do 
know that 4.7.x has great support for autonumbering, which might be a 
better solution.  (check out the latest "WHATSNEW" file for 4.7).

>Okay, I lied, one more thing. How did you
>figure out how to do this? I appreciate your help.

I think it's in the docs somewhere (I read them through a few times for 
good measure), but you can really tell how I "figured this out" by looking 
up my name in the mailing list.  :-)  I've been getting less and less 
clueless since August.

Enjoy Interchange, Gabe.  It's among the few and proud with such good DB 
support.

-Dan B.

> >
> > 1. start with default template construct
> > 2. add one field to database
> >          psql -c "ALTER TABLE products ADD COLUMN foo VARCHAR(64);"
> > 3. add said field to dbconf/pgsql/products.pgsql
> > 4. make sure you're not importing from text db
> >          touch products/products.sql
> > 5. restart interchange
> >
> > You can often skip step 2 if you replace step 4 with "add another
> > column to
> > products/products.txt".
> >
> > HTH,
> >
> > Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com

Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com