diff --git a/README.md b/README.md index 10ef068..181d6ba 100644 --- a/README.md +++ b/README.md @@ -707,8 +707,8 @@ kallax migrate up --dir ./my-migrations --dsn 'user:pass@localhost:5432/dbname?s | --- | --- | | `kallax.ULID` | `uuid` | | `kallax.UUID` | `uuid` | -| `kallax.NumericID` | `serial` on primary keys, `bigint` on foreign keys | -| `int64` on primary keys | `serial` | +| `kallax.NumericID` | `bigserial` on primary keys, `bigint` on foreign keys | +| `int64` on primary keys | `bigserial` | | `int64` on foreign keys and other fields| `bigint` | | `string` | `text` | | `rune` | `char(1)` | diff --git a/generator/migration.go b/generator/migration.go index 2149254..fecc56a 100644 --- a/generator/migration.go +++ b/generator/migration.go @@ -1014,7 +1014,7 @@ var typeMappings = map[string]ColumnType{ var idTypeMappings = map[string]ColumnType{ "kallax.ULID": UUIDColumn, "kallax.UUID": UUIDColumn, - "kallax.NumericID": SerialColumn, + "kallax.NumericID": BigSerialColumn, } func reverse(slice []string) []string { diff --git a/generator/migration_test.go b/generator/migration_test.go index 0dbfd60..244d9d0 100644 --- a/generator/migration_test.go +++ b/generator/migration_test.go @@ -602,7 +602,7 @@ type Profile struct { type ProfileMetadata struct { kallax.Model ` + "`table:\"metadata\"`" + ` - // it's an pk, should be serial + // it's an pk, should be bigserial ID int64 ` + "`pk:\"autoincr\"`" + ` // a json field Metadata map[string]interface{} @@ -635,7 +635,7 @@ func (s *PackageTransformerSuite) TestTransform() { expected := mkSchema( mkTable( "profiles", - mkCol("id", SerialColumn, true, true, nil), + mkCol("id", BigSerialColumn, true, true, nil), mkCol("color", ColumnType("char(6)"), false, true, nil), mkCol("background", TextColumn, false, true, nil), mkCol("user_id", UUIDColumn, false, false, mkRef("users", "id", true)), @@ -644,7 +644,7 @@ func (s *PackageTransformerSuite) TestTransform() { ), mkTable( "metadata", - mkCol("id", SerialColumn, true, true, nil), + mkCol("id", BigSerialColumn, true, true, nil), mkCol("metadata", JSONBColumn, false, true, nil), mkCol("profile_id", BigIntColumn, false, true, mkRef("profiles", "id", false)), ),