sqldb: ensure schema definitions are fully SQLite compatible

Previously, we applied replacements to our schema definitions
to make them compatible with both SQLite and Postgres backends,
as the files were not fully compatible with either.

With this change, the only replacement required for SQLite has
been moved to the generator script. This adjustment ensures
compatibility by enabling auto-incrementing primary keys that
are treated as 64-bit integers by sqlc.
This commit is contained in:
Andras Banki-Horvath
2025-01-21 17:00:15 +01:00
parent ea98933317
commit 84598b6dc1
8 changed files with 44 additions and 20 deletions

View File

@@ -28,13 +28,10 @@ const (
)
var (
// sqliteSchemaReplacements is a map of schema strings that need to be
// replaced for sqlite. This is needed because sqlite doesn't directly
// support the BIGINT type for primary keys, so we need to replace it
// with INTEGER.
sqliteSchemaReplacements = map[string]string{
"BIGINT PRIMARY KEY": "INTEGER PRIMARY KEY",
}
// sqliteSchemaReplacements maps schema strings to their SQLite
// compatible replacements. Currently, no replacements are needed as our
// SQL schema definition files are designed for SQLite compatibility.
sqliteSchemaReplacements = map[string]string{}
// Make sure SqliteStore implements the MigrationExecutor interface.
_ MigrationExecutor = (*SqliteStore)(nil)