Skip to content

Commit

Permalink
Add support for column primary option (#13)
Browse files Browse the repository at this point in the history
* Add support for column primary option

* go mod tidy

* Update dependencies
  • Loading branch information
lafriks committed Nov 5, 2021
1 parent 6b33dfc commit 977b3d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
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.29.0
github.com/go-rel/sql v0.6.0
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.29.0 h1:RmU+o+8f3HItQtTfz30TJIENvYVcIUC7dR15U5czUn0=
github.com/go-rel/rel v0.29.0/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.6.0 h1:QNzZmZ+ATrQi4YkepKP96KNabYHHLZenA/5k+3sNlW8=
github.com/go-rel/sql v0.6.0/go.mod h1:HDDtkakv+O3YKxtXj4g2DrtUVZPAZao/MoUmD5j7JTk=
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

0 comments on commit 977b3d6

Please sign in to comment.