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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Robert Walker at Dec 1, 2011 at 10:43 pm

    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:

    https://github.com/drnic/composite_primary_keys

    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.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Erwin at Dec 2, 2011 at 7:13 am
    Thanks a lot Walter .. I'll have a look at it
    On Dec 1, 11:43 pm, Robert Walker wrote:
    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:

    https://github.com/drnic/composite_primary_keys

    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.

    --
    Posted viahttp://www.ruby-forum.com/.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 1, '11 at 5:57p
activeDec 2, '11 at 7:13a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Erwin: 2 posts Robert Walker: 1 post

People

Translate

site design / logo © 2021 Grokbase