Re: DataObject: createtables doesn't overwrite after DBMS change
| From: | Alan Knowles | Date: | Tue, 30 Sep 2003 08:58:12 +0000 |
| Subject: | Re: DataObject: createtables doesn't overwrite after DBMS change | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22207@lists.php.net to get a copy of this message | ||
It's worth investigating the output from $db->tableInfo('player_track') - as that where dataobjects get's its information from.
The comments are built up from the return value of tableInfo - I think for postgres it looks for 'next_val' or similar in the table info to determine if it's a key column. although it might also test for primary_key..
Regards
Alan
Jeroen Houben wrote:
Hi This is really a minor thing but I thought I should mentioned it anyway.. My table in pgsql looks like this. Notice there are no keys defnied. CREATE TABLE "player_track" ( "player_id" SMALLINT DEFAULT '0' NOT NULL, "position" SMALLINT DEFAULT '0' NOT NULL, "altered" TIMESTAMP WITHOUT TIME ZONE NOT NULL ) WITH OIDS; [player_track] player_id = 1 position = 1 altered = 2 [player_track__keys] Now in the comments of the auto generated code below it says there are two Primary Keys: player_id and altered. This is a result of the code generated for MySql. I however switched to PG but the auto code isn't overwritten properly I don't think. I don't know if DO uses those comments for anything (I don't think so) but everything works fine as far as I can tell. Easy solution is to delete the classes generated for MySql and re-run createTables.php, but in some other classes I have a lot of handwritten code I don't want to delete. ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comvar $__table = 'player_track'; // table name var $player_id; // int(5) not_null primary_key unsigned var $position; // int(3) not_null unsigned var $altered; // timestamp(14) not_null primary_key unsigned zerofill timestamp