Page 1 of 1

Composite keys

Posted: 2013-10-29 17:08
by tguimond
I have a table that has this layout in MySQL:
'CREATE TABLE `bread` (
`rundate` varchar(20) NOT NULL,
`runtime` varchar(20) NOT NULL,
`bread` int(11) DEFAULT NULL,
`lread` int(11) DEFAULT NULL,
`rcache` int(11) DEFAULT NULL,
`bwrit` int(11) DEFAULT NULL,
`lwrit` int(11) DEFAULT NULL,
`wcache` int(11) DEFAULT NULL,
`pread` int(11) DEFAULT NULL,
`pwrit` int(11) DEFAULT NULL,
PRIMARY KEY (`rundate`,`runtime`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1'

When I try to generate the app, I get this error message: Table 'bread' has too many primary keys. Only one primary key is allowed per table. Is there a way to use composite keys?
How do I work around this?

Thanks,
Tim

Re: Composite keys

Posted: 2013-10-29 17:46
by AhmedBR
Did you try to set one primary key in AppGini and do the rest in phpMyAdmin?

I mean something like what I did here:
http://forums.appgini.com/phpbb/viewtopic.php?f=4&t=814

Re: Composite keys

Posted: 2013-10-29 18:46
by tguimond
No, I hadn't done any experimenting like that yet.
There really aren't two primary keys, there is actually only one composite key (rundate, runtime). These two fields are required to make the unique index, but you got me thinking that I could make a single column (rundatetime) that I build before I put the data into the database and this would get me around the issue where AppGini thinks that I actually have two primary keys.
Thanks,
Tim