Erwin1
(Erwin)
1
how can I rewrite the migration script to generate the composite keys
from an existing table
......
PRIMARY KEY (`id`),
KEY `by_scheduled_sent_released`
(`scheduled_at`,`sent_at`,`released_at`),
KEY `by_account_uidl` (`account_id`,`unique_id`),
KEY `by_account_message` (`account_id`,`message_id`),
KEY `by_released_sent_received`
(`released_at`,`sent_at`,`received_at`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
is it true that Rails doesn't support it ?
thanks fy feedback
11155
(-- --)
2
Kad Kerforn wrote in post #1034598:
how can I rewrite the migration script to generate the composite keys
from an existing table
......
PRIMARY KEY (`id`),
KEY `by_scheduled_sent_released`
(`scheduled_at`,`sent_at`,`released_at`),
KEY `by_account_uidl` (`account_id`,`unique_id`),
KEY `by_account_message` (`account_id`,`message_id`),
KEY `by_released_sent_received`
(`released_at`,`sent_at`,`received_at`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
is it true that Rails doesn't support it ?
It is true that ActiveRecord does not support composite keys, not
without help. Thankfully, there is a gem for that:
Note: I have not used this gem and have no opinion about it one way or
the other. It is just the first one to come up in the Github search.
Erwin1
(Erwin)
3
Thanks a lot Walter .. I'll have a look at it