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

Use 64bit primary keys in DB #548

Merged
merged 4 commits into from
Oct 4, 2023
Merged

Use 64bit primary keys in DB #548

merged 4 commits into from
Oct 4, 2023

Conversation

guggero
Copy link
Member

@guggero guggero commented Oct 4, 2023

Fixes #533.

We use a BIGINT for all our primary and foreign keys, as that will
generate int64 types in the generated sqlc code.
We'll use translation rules to translate the primary keys into actually
auto-incrementing types for the two supported DB backends:

Postgres:
	BIGINT PRIMARY KEY	==>	BIGSERIAL PRIMARY KEY

SQlite:
	BIGINT PRIMARY KEY	==>	INTEGER PRIMARY KEY
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦜

@@ -131,8 +131,12 @@ func NewSqliteStore(cfg *SqliteConfig) (*SqliteStore, error) {
return nil, err
}

sqliteFS := newReplacerFS(sqlSchemas, map[string]string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

Minimal, yet very useful abstraction!

@Roasbeef Roasbeef merged commit affe4f9 into main Oct 4, 2023
14 checks passed
@guggero guggero deleted the use-64bit-primary-keys branch October 5, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[feature]: add support for int64 ids to tapdb
2 participants