Skip to content

Add support for column primary option #13

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

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.17

require (
github.com/go-rel/primaryreplica v0.1.0
github.com/go-rel/rel v0.28.0
github.com/go-rel/sql v0.5.0
github.com/go-rel/rel v0.28.1-0.20211104132839-e53441586213
github.com/go-rel/sql v0.5.1-0.20211104200139-ea1b870f77c3
github.com/jackc/pgx/v4 v4.13.0
github.com/lib/pq v1.10.3
github.com/stretchr/testify v1.7.0
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-rel/primaryreplica v0.1.0 h1:ARt8QHa55Tmz7hJYtGunz4B3THQiFDOJb0yZBgnrzx4=
github.com/go-rel/primaryreplica v0.1.0/go.mod h1:j/b9RmL4gdnuQMh4UPBeE1h6RpQCtiUIC9QHIvgjIs8=
github.com/go-rel/rel v0.27.0/go.mod h1:zaIYPmM3AfJrh0xBmm7KoVKRgTNvr0cgZfcJ88gVA2U=
github.com/go-rel/rel v0.28.0 h1:gRcQjNbwuFL35RxeHFMKSy3a/xV+WbtkA8wP24dWPEA=
github.com/go-rel/rel v0.28.0/go.mod h1:zaIYPmM3AfJrh0xBmm7KoVKRgTNvr0cgZfcJ88gVA2U=
github.com/go-rel/sql v0.5.0 h1:+TVS9JvEl06Q8rswwuWlY6VZ+gwSBX9um+vKuZ9gsyY=
github.com/go-rel/sql v0.5.0/go.mod h1:2YwenlIaHpTqdD/KPVYG7Y5Ub1+sn1winlC8TrighRU=
github.com/go-rel/rel v0.28.1-0.20211104132839-e53441586213 h1:xOHuM1nbUvpZryhSPREkGzJunQVOa8xkF09UCqQaVMA=
github.com/go-rel/rel v0.28.1-0.20211104132839-e53441586213/go.mod h1:RiTs/9DBCiSZvVRin8mXMXBeXIuJ5JpQThccwtrdqfc=
github.com/go-rel/reltest v0.4.0 h1:Z/x9FXZ8yDdrU2MuzPpt7FUIptSEV1pnmSKxSlcUhtM=
github.com/go-rel/reltest v0.4.0/go.mod h1:3udgrKCZGCMFWc8k+RH975gUdUFPE/yspG2iWN9gjqU=
github.com/go-rel/sql v0.5.1-0.20211104200139-ea1b870f77c3 h1:1it81i2wpTxsKUp65HicmVzGhrPEtCIzhIHZId0E+zg=
github.com/go-rel/sql v0.5.1-0.20211104200139-ea1b870f77c3/go.mod h1:ShnMcrpRTL7k9ydze4xsm7DI4RgDub6qKbrBj0FS6bQ=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
Expand Down
4 changes: 2 additions & 2 deletions postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ func columnMapper(column *rel.Column) (string, int, int) {

switch column.Type {
case rel.ID:
typ = "SERIAL NOT NULL PRIMARY KEY"
typ = "SERIAL NOT NULL"
case rel.BigID:
typ = "BIGSERIAL NOT NULL PRIMARY KEY"
typ = "BIGSERIAL NOT NULL"
case rel.DateTime:
typ = "TIMESTAMPTZ"
if t, ok := column.Default.(time.Time); ok {
Expand Down