Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)` |
Expand Down
2 changes: 1 addition & 1 deletion generator/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions generator/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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)),
Expand All @@ -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)),
),
Expand Down