Repository navigation
Conversation
Serial columns without a primary key (cycle/database#106, 2.5.0) were undocumented, and the per-driver behaviour differs a lot: only PostgreSQL has a real non-PK counter, MySQL folds an AUTO_INCREMENT column into the primary key, SQLite and SQL Server have no option for it (#175). Assisted-By: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #175.
Primary-key auto-increment was already covered; this documents auto-incremented columns that are not the primary key.
database/declaration.md: a new "Auto-increment Columns Outside the Primary Key" section with per-driver behaviour — PostgreSQLserial()/bigSerial()/smallSerial()(Adding the ability to use serial without primary key database#106, 2.5.0); MySQL, where anautoIncrement: truecolumn is always added to the primary key and the table is created only with the counter first in it; no support on SQLite and SQL Server.annotated/entity.md: an entity example with aserialcolumn and#[GeneratedValue(onInsert: true)], how the value is read back (RETURNINGon PostgreSQL, not on MySQL), and what happens on other drivers.Checked on PostgreSQL 17 and MySQL 8.0 (schema and ORM paths), SQLite, and the column DDL every driver renders, against cycle/database 2.x, cycle/orm 2.x and cycle/annotated 4.x.