Saturday, January 19, 2008

Database Changes

In working to convert the apgschema to the Ruby on Rails convention, I had to give every table an ID in order for the links from the automatically created table to work.

In doing this, mostly I added a new ID field, but for some of them, I changed the existing primary key.

I had to execute:
SQL:
SET @maxId= 0;
UPDATE mytable SET id = ( SELECT @maxId := @maxId+1 ) WHERE 1 ;
to put the ID

I found at:
http://www.rafaeldohms.com.br/2006/09/28/creating-a-primary-key-in-a-populated-table/en/

It also creates UI for the whole database, the result of this is that we get UI with fields like CO RESERVE AMT. I could either change the database, or go into each of the UI files and alter it there. It seems to make more sense to change the database, but I'm gonna hold off for now.

No comments: