Hi Earle,

> With SQLite3, the db any field that is defined as INTEGER PRIMARY KEY is
> auto-populated during record creation.  The presence or absence of the
> AUTOINCREMENT keyword only serves to determine which algorithm is used
> to generate the next value.  According to the SQLite3 website, it's
> better to not use the AUTOINCREMENT keyword unless necessary for a
> particular design, as it causes more work for the database. I would
> submit that the default Serial type for SQLite3 should be INTEGER NOT
> NULL PRIMARY KEY.  Here's a link for more 
> info:http://www.sqlite.org/autoinc.html

Ahh, this is good to know.  Can you submit a ticket at
http://datamapper.lighthouseapp.com/ to have this looked into
further?  I'm fine with changing it provided it doesn't change the
observable behavior of any apps or plugins.

> > The second statement above appears to be the same as what's generated
> > for: property :id, Integer, :key => true
>
> Not quite. property :id, Integer, :key => true generates this:
> id INTEGER NOT NULL, PRIMARY KEY(id)
>
> Note that in this case, the PRIMARY KEY is defined on the table, not on
> the column.  Whether or not this makes any real difference in DM or the
> db, I don't know.

The reason for this is that DM assumes all a PKs or FKs can be more
than one column, so it defines the PRIMARY KEY on the table rather
than on the column.

Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to