From: Todd Benson Date: 2008-06-25T03:51:37+09:00 Subject: Re: Sequel primary keys On Tue, Jun 24, 2008 at 1:13 PM, Glen Holcomb wrote: > On Tue, Jun 24, 2008 at 11:03 AM, Robert Klemme > wrote: > >> On 24.06.2008 18:01, Glen Holcomb wrote: >> >>> I posted to the Sequel Google Group but it's horribly slow, assuming it >>> took >>> my post. >>> >>> Does anyone on here know if it is possible to create a non-integer primary >>> key in Sequel? If so how? Also help with creating a non integer foreign >>> key would be great too. I've done some poking through the Rdoc and some >>> experimentation and it wants to make everything :integer or AUTOINCREMENT. >>> >> >> The docs seem to indicate that you can use arbitrary PK's: >> >> http://sequel.rubyforge.org/classes/Sequel/Schema/Generator.html#M000257 >> >> So, if int is enforced there is a bug - either in your code or in Sequel's >> code. >> >> Kind regards >> >> robert >> >> > Thanks for the input Robert. > > It turns out there is a rather vaguely documented :auto_increment => false > that needed to be included in my primary_key definition. Now I just need to > figure out how to get foreign_keys to work. The sequel-talk group seems to > be working so I will continue this pursuit there. > > Thanks again. > > -- > "Hey brother Christian with your high and mighty errand, Your actions speak > so loud, I can't hear a word you're saying." > > -Greg Graffin (Bad Religion) I don't want to hijack this thread, and people may be mad about me saying this again. Will you (that would be people in general and doesn't include Greg as far as I can see) please stop using auto_increment as a guarantee of uniqueness in a database/set?! The set theory should be handled in the db anyway, IMHO. It's convenient, but think, for example, if you move a postresql db schema to oracle, or vice versa, or even worse to SQLite (nothing against you guys, I think you have a really cool product and am looking forward to future updates). Anyways, "Uh-oh." "Price is Right" ... buy another key so we can move on. Silly. This is how mud/clay is added to structures because people think they are being practical engineers. Ruby is good stuff. Let's use it in a good way! Likewise, the databases need to be used correctly. Todd