Closed salieri closed 1 year ago
This is a long-standing issue (see this long conversation over in the Geddy repo: https://github.com/mde/geddy/issues/452) There is ostensibly the support for auto-incrementing IDs (an autoIncrementId
property on the base model object), but it's never been well documented or well supported.
It needs to be global to the entire instance of Model, since the 'id' field is a special field that's managed by the framework (a good example is foreign keys for associations).
I would absolutely love for this feature to work correctly and consistently. Do you suppose you could adjust this PR to work well with the global setting? (I realize this setting is problematic for NoSQL adapters like Mongo, but let's just say for simplicity's sake that only SQL adapters will ever flip it on.)
Will be happy to refactor.
That would be fantastic. Definitely need some good tests for this, since it's off by default, and has been prone to breakage a lot in the past.
Any progress on this?
Oh, that reminds me -- this needs to work for SQLite as well. All SQL adapters should behave the same if possible.
Will get back to you after crunch mode is over, give it a few weeks.
Excellent. Lemme know if there's anything I need to do.
Provide an option for Postgres and MySQL configurations to use autoincrementing (numeric) row IDs rather than UUIDs.
Configurable (defaults off) via the database adapter configuration object (e.g.
geddy.config.db
). Setautoincrement = true
to activate. Configuration affects all tables of the adapter in question.Not taking in account table creation yet. Will support if needed.