This project is archived and is in readonly mode.
create_table with explicit :primary_key attribute
-
James Le Cuirot
What you've tried to do doesn't quite make sense. You want your primary key to be a string? I'm not sure if Rails supports this. In any case, it isn't possible to do this with migrations. The :primary_key option for create_table is simply for giving a different name for the column. You're not supposed to give an alternative definition for that column as well. This does highlight the issue I was going to raise when I stumbled across this ticket though. It is currently not possible to choose a limit for the primary key either. It is hardcoded to int(11).
-
Tony Pitale
It is not currently possible to use string keys with AR (and I doubt it ever will be). Ran into that a few months ago with a legacy db.
-
Tarmo Tänav
- State changed from new to duplicate
- Tag changed from activerecord to activerecord
#876 seems to try to address this