Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AUTOINCREMENT directive in SQLite #936

Merged
merged 4 commits into from
Jan 10, 2024

Conversation

bevzzz
Copy link
Contributor

@bevzzz bevzzz commented Nov 29, 2023

At the moment sqlite dialect ignores bun:",autoincrement" tag, relying on the default ROWID behaviour instead.
However, AUTOINCREMENT keyword is a separate instruction in SQLite that creates a dedicated sequence and changes how the unique IDs for the table are generated.

Related issue: #929

This PR adds support for AUTOINCREMENT keyword for fields which have the autoincrement tag. See the docs for sqlitedialect.Dialect.AppendSequence for more details.

I also noticed that each dialect has different keywords for creating generated columns, so I also pushed this logic to the dialects' via new AppendSequence method.

query_table_create.go Outdated Show resolved Hide resolved
@vmihailenco
Copy link
Member

@bevzzz looks good with few notes 👍

@vmihailenco vmihailenco merged commit 8b5c3a3 into uptrace:master Jan 10, 2024
3 checks passed
@bevzzz bevzzz deleted the fix/929-sqlite-autoincrement branch January 10, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants