Skip to content

Commit

Permalink
v6.0.0 (#670)
Browse files Browse the repository at this point in the history
* fix: improve model ID field customization (#604)

Updates places where `"id"` was hardcoded instead of using `model.IDField()`.

* Ensure uninitialized map is initialized when unmarshaling json
Add tests for this scenario

* exclude migration_table_name from connection string

* add test for OptionsString

* Add support for pointer FKs when preloading a belongs_to association (#602)

* feat: support context-aware tablenames (#614)

This patch adds a feature which enables pop to pass down the connection context to the model's TableName() function by implementing TableName(ctx context.Context) string. The context can be used to dynamically generate tablenames which can be important for prefixed or generic tables and other use cases.

* Bump pg deps (#616)

* Reset to development

* bumping pgx and pgconn versions

Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* Latest from master (#620)

* Latest from development (#617)

* fix: improve model ID field customization (#604)

Updates places where `"id"` was hardcoded instead of using `model.IDField()`.

* Ensure uninitialized map is initialized when unmarshaling json
Add tests for this scenario

* exclude migration_table_name from connection string

* add test for OptionsString

* Add support for pointer FKs when preloading a belongs_to association (#602)

* feat: support context-aware tablenames (#614)

This patch adds a feature which enables pop to pass down the connection context to the model's TableName() function by implementing TableName(ctx context.Context) string. The context can be used to dynamically generate tablenames which can be important for prefixed or generic tables and other use cases.

* Bump pg deps (#616)

* Reset to development

* bumping pgx and pgconn versions

Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* adding goreleaser syntaz (#619)

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* Resolve issues in UPDATE and DELETE when using schemas (#618)

* Resolve MySQL issues and improve test migrations
* Bump CockroachDB to maintained and supported versions
Version 2.1 has reached EoL in 2019

Signed-off-by: aeneasr <[email protected]>

* Use `PaginatorPageKey` and `PaginatorPerPageKey` variables (#615)

* update pagination_test

* Pass Time structure into timestamp update functions. (#625)

Closes #624

* Allow nullable JSONB and resolve MySQL regression (#639)

* Allow passing args to `Order` (#630)

* Added connection maximum idle time configuration (#635)

This PR add the possibility to configure the connection maximum idle time (https://golang.org/pkg/database/sql/#DB.SetConnMaxIdleTime).

Closes #632

BREAKING CHANGE: Requires Go 1.15 from now on.

* Bump sqlite to 3.35.4 / 1.14.7 (#642)

* Update pg, pgx, sqlx (#643)

- `jackc/pgx` to  version `v4.11.0`.
- `jmoiron/sqlx` to version`v1.3.3`
- `lib/pq` to version`v1.10.1`

* Fix Inner has many associations when passing on multiple arguments (#633)

* Fix Inner has many associations when passing on multiple arguments for inner fields

* Fix broken tests

* clean up extractFieldAndInnerFields function

Co-authored-by: hackerman <[email protected]>
Co-authored-by: Antonio Pagano <[email protected]>

* Remove many to many TX condition for EagerPreload (#645)

* Remove the need to use Tx when loading many to many associations

* replace TX access to create a new tx.Store.Transaction() object

* Added fix/tests for has_many with pointer foreign key (#647)

Co-authored-by: Antonio Pagano <[email protected]>

* Export WhereID, Alias, WhereNamedID (#637)

This patch export some model convenience functions which are useful when constructing queries outside of pop: custom updates, deletes, inserts, ...

Signed-off-by: aeneasr <[email protected]>

Co-authored-by: Antonio Pagano <[email protected]>

* fix: log model values everywhere (#656)

Some SQL logs were missing the values as argument. This adds all places

* Add delete to query builder (#658)

This allows writing delete queries without knowing the exact primary key or for composite keys.
`Destroy` only allows to delete by primary key, but there are many cases where you want to delete multiple rows or by some other query than the ID.

See #29

* Sort down migrations (#657)

Basically, just reversing the up migration order does not work, as that puts "all" migrations before specific ones. Therefore, I added implemented the proper `Less` function for down migrations explicitly.

Related #533

Co-authored-by: hackerman <[email protected]>

* Preserve eager information when validating models (#664) (#665)

Co-authored-by: Karl Haas <[email protected]>

* Migrate from packr to fs (#667)

* Updating Pgx (#660)

* adding goreleaser syntaz

* updating pgx now really

* Migrate from packr to fs

* Migrate to v6

* Use old build tags

* Update error handling

* Fix error after rebase

* Fix error handling

* Fix filenames for embed Go 1.16 usage

Co-authored-by: Antonio Pagano <[email protected]>

* Task merging master (#669)

* v5.3.4 (#644)

* fix: improve model ID field customization (#604)

Updates places where `"id"` was hardcoded instead of using `model.IDField()`.

* Ensure uninitialized map is initialized when unmarshaling json
Add tests for this scenario

* exclude migration_table_name from connection string

* add test for OptionsString

* Add support for pointer FKs when preloading a belongs_to association (#602)

* feat: support context-aware tablenames (#614)

This patch adds a feature which enables pop to pass down the connection context to the model's TableName() function by implementing TableName(ctx context.Context) string. The context can be used to dynamically generate tablenames which can be important for prefixed or generic tables and other use cases.

* Bump pg deps (#616)

* Reset to development

* bumping pgx and pgconn versions

Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* Latest from master (#620)

* Latest from development (#617)

* fix: improve model ID field customization (#604)

Updates places where `"id"` was hardcoded instead of using `model.IDField()`.

* Ensure uninitialized map is initialized when unmarshaling json
Add tests for this scenario

* exclude migration_table_name from connection string

* add test for OptionsString

* Add support for pointer FKs when preloading a belongs_to association (#602)

* feat: support context-aware tablenames (#614)

This patch adds a feature which enables pop to pass down the connection context to the model's TableName() function by implementing TableName(ctx context.Context) string. The context can be used to dynamically generate tablenames which can be important for prefixed or generic tables and other use cases.

* Bump pg deps (#616)

* Reset to development

* bumping pgx and pgconn versions

Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* adding goreleaser syntaz (#619)

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>

* Resolve issues in UPDATE and DELETE when using schemas (#618)

* Resolve MySQL issues and improve test migrations
* Bump CockroachDB to maintained and supported versions
Version 2.1 has reached EoL in 2019

Signed-off-by: aeneasr <[email protected]>

* Use `PaginatorPageKey` and `PaginatorPerPageKey` variables (#615)

* update pagination_test

* Pass Time structure into timestamp update functions. (#625)

Closes #624

* Allow nullable JSONB and resolve MySQL regression (#639)

* Allow passing args to `Order` (#630)

* Added connection maximum idle time configuration (#635)

This PR add the possibility to configure the connection maximum idle time (https://golang.org/pkg/database/sql/#DB.SetConnMaxIdleTime).

Closes #632

BREAKING CHANGE: Requires Go 1.15 from now on.

* Bump sqlite to 3.35.4 / 1.14.7 (#642)

* Update pg, pgx, sqlx (#643)

- `jackc/pgx` to  version `v4.11.0`.
- `jmoiron/sqlx` to version`v1.3.3`
- `lib/pq` to version`v1.10.1`

* Fix Inner has many associations when passing on multiple arguments (#633)

* Fix Inner has many associations when passing on multiple arguments for inner fields

* Fix broken tests

* clean up extractFieldAndInnerFields function

Co-authored-by: hackerman <[email protected]>
Co-authored-by: Antonio Pagano <[email protected]>

* Remove many to many TX condition for EagerPreload (#645)

* Remove the need to use Tx when loading many to many associations

* replace TX access to create a new tx.Store.Transaction() object

* Added fix/tests for has_many with pointer foreign key (#647)

Co-authored-by: Antonio Pagano <[email protected]>

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>
Co-authored-by: Brian Buchholz <[email protected]>
Co-authored-by: Mike Pontillo <[email protected]>
Co-authored-by: Benjamin Blattberg <[email protected]>
Co-authored-by: Jonathan Duck <[email protected]>
Co-authored-by: Arthur Knoepflin <[email protected]>

* Updating Pgx (#660)

* adding goreleaser syntaz

* updating pgx now really

* tidying

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>
Co-authored-by: Brian Buchholz <[email protected]>
Co-authored-by: Mike Pontillo <[email protected]>
Co-authored-by: Benjamin Blattberg <[email protected]>
Co-authored-by: Jonathan Duck <[email protected]>
Co-authored-by: Arthur Knoepflin <[email protected]>

Co-authored-by: Patrik <[email protected]>
Co-authored-by: Michael Montgomery <[email protected]>
Co-authored-by: kyrozetera <[email protected]>
Co-authored-by: Reggie Riser <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: Stanislas Michalak <[email protected]>
Co-authored-by: Larry M Jordan <[email protected]>
Co-authored-by: Brian Buchholz <[email protected]>
Co-authored-by: Mike Pontillo <[email protected]>
Co-authored-by: Benjamin Blattberg <[email protected]>
Co-authored-by: Jonathan Duck <[email protected]>
Co-authored-by: Arthur Knoepflin <[email protected]>
Co-authored-by: karlhaas <[email protected]>
Co-authored-by: Karl Haas <[email protected]>
Co-authored-by: Matthias Fasching <[email protected]>
  • Loading branch information
16 people authored Nov 23, 2021
1 parent 4c1da2d commit c285511
Show file tree
Hide file tree
Showing 100 changed files with 1,311 additions and 909 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
name: Release

on:
create:
tags:
- v*.*.*
release:
types:
- published

jobs:
release:
name: Release
runs-on: ubuntu-latest
container:
image: bepsays/ci-goreleaser:1.15.1
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
fetch-depth: 0
go-version: 1.17
id: go

- name: Checkout Code
uses: actions/checkout@v2

- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
with:
Expand Down
142 changes: 75 additions & 67 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
name: Tests
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
mysql-tests:
name: MySQL tests
name: MySQL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.16.x"
- "1.17.x"

services:
mysql:
Expand All @@ -16,18 +26,12 @@ jobs:
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.15
id: go
- name: Checkout Code
uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
fetch-depth: 1
- name: Get dependencies
run: |
go get -v -tags sqlite -t -d ./...
go-version: ${{ matrix.go-version }}

- name: Build and run soda
env:
SODA_DIALECT: "mysql"
Expand All @@ -37,20 +41,26 @@ jobs:
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "mysql"
MYSQL_PORT: 3307
run: |
go test -tags sqlite -race ./...
go test -tags sqlite -race -cover ./...
pg-tests:
name: PostgreSQL tests
name: PostgreSQL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.16.x"
- "1.17.x"

services:
postgres:
image: postgres:10.8
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -61,18 +71,12 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.15
id: go
- name: Checkout Code
uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
fetch-depth: 1
- name: Get dependencies
run: |
go get -v -tags sqlite -t -d ./...
go-version: ${{ matrix.go-version }}

- name: Build and run soda
env:
SODA_DIALECT: "postgres"
Expand All @@ -82,30 +86,30 @@ jobs:
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "postgres"
POSTGRESQL_URL: "postgres://postgres:[email protected]:${{ job.services.postgres.ports[5432] }}/pop_test?sslmode=disable"
run: |
go test -tags sqlite -race ./...
go test -tags sqlite -race -cover ./...
crdbssl-tests:
name: Cockroach SSL tests
name: Cockroach SSL tests - Go v${{ matrix.go-version }}
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.16.x"
- "1.17.x"

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.15
id: go
- name: Checkout Code
uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
fetch-depth: 1
- name: Get dependencies
run: |
go get -v -tags sqlite -t -d ./...
go-version: ${{ matrix.go-version }}

- name: Install Cockroach SSL
run: |
mkdir -p crdb/certs
Expand All @@ -117,6 +121,7 @@ jobs:
./cockroach cert create-node localhost 127.0.0.1 `hostname -s` `hostname -f` --certs-dir certs --ca-key key
./cockroach start-single-node --certs-dir certs --listen-addr localhost --port 26259 --http-port 8089 --background
popd
- name: Build and run soda
env:
SODA_DIALECT: "cockroach_ssl"
Expand All @@ -125,29 +130,29 @@ jobs:
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "cockroach_ssl"
run: |
go test -tags sqlite -race ./...
go test -tags sqlite -race -cover ./...
crdb-tests:
name: Cockroach tests
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.16.x"
- "1.17.x"

steps:
- name: Set up Go
uses: actions/setup-go@v1
- uses: actions/checkout@v2
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: 1.15
id: go
- name: Checkout Code
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Get dependencies
run: |
go get -v -tags sqlite -t -d ./...
go-version: ${{ matrix.go-version }}

- name: Install Cockroach
run: |
mkdir -p crdb
Expand All @@ -156,6 +161,7 @@ jobs:
mv cockroach-v20.2.4.linux-amd64/cockroach .
./cockroach start-single-node --insecure --background
popd
- name: Build and run soda
env:
SODA_DIALECT: "cockroach"
Expand All @@ -164,32 +170,33 @@ jobs:
./tsoda drop -e $SODA_DIALECT -p ./testdata/migrations
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
- name: Test
env:
SODA_DIALECT: "cockroach"
run: |
go test -tags sqlite -race ./...
go test -tags sqlite -race -cover ./...
sqlite-tests:
name: SQLite tests
name: SQLite tests ${{ matrix.os }} - Go v${{ matrix.go-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
go-version:
- "1.16.x"
- "1.17.x"
os:
- "macos-latest"
- "windows-latest"
- "ubuntu-latest"

steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.15
id: go
- name: Checkout Code
uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
fetch-depth: 1
- name: Get dependencies
run: |
go get -v -tags sqlite -t -d ./...
go-version: ${{ matrix.go-version }}

- name: Build and run soda
env:
SODA_DIALECT: "sqlite"
Expand All @@ -199,8 +206,9 @@ jobs:
./tsoda create -e $SODA_DIALECT -p ./testdata/migrations
./tsoda migrate -e $SODA_DIALECT -p ./testdata/migrations
shell: bash

- name: Test
env:
SODA_DIALECT: "sqlite"
run: |
go test -tags sqlite -race ./...
go test -tags sqlite -race -cover ./...
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ run:
linters-settings:
govet:
# report about shadowed variables
check-shadowing: true
check-shadowing: true
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ TAGS ?= "sqlite"
GO_BIN ?= go

install: deps
packr2
$(GO_BIN) install -tags ${TAGS} -v ./soda

deps:
$(GO_BIN) get github.com/gobuffalo/release
$(GO_BIN) get github.com/gobuffalo/packr/v2/packr2
$(GO_BIN) get -tags ${TAGS} -t ./...
ifeq ($(GO111MODULE),on)
$(GO_BIN) mod tidy
endif

build:
packr2
$(GO_BIN) build -v .

test:
# packr2
$(GO_BIN) test -tags ${TAGS} ./...

ci-test:
Expand All @@ -32,7 +28,6 @@ update:
ifeq ($(GO111MODULE),on)
$(GO_BIN) mod tidy
endif
packr2
make test
make install
ifeq ($(GO111MODULE),on)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center"><img src="logo.png" width="150" height="150"></p>

<p align="center">
<a href="https://pkg.go.dev/github.com/gobuffalo/pop/v5"><img src="https://godoc.org/github.com/gobuffalo/pop?status.svg" alt="GoDoc" /></a>
<a href="https://pkg.go.dev/github.com/gobuffalo/pop/v6"><img src="https://godoc.org/github.com/gobuffalo/pop?status.svg" alt="GoDoc" /></a>
<a href="https://github.com/gobuffalo/pop/actions?query=workflow%3ATests+branch%3Amaster"><img src="https://github.com/gobuffalo/pop/workflows/Tests/badge.svg" alt="Build Status" /></a>
</p>

Expand Down
7 changes: 0 additions & 7 deletions SHOULDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Pop does not try to reinvent the wheel! Instead, it uses the already great wheel

Thank you to the following **GIANTS**:


* [github.com/cockroachdb/apd](https://godoc.org/github.com/cockroachdb/apd)

* [github.com/cockroachdb/cockroach-go](https://godoc.org/github.com/cockroachdb/cockroach-go)
Expand All @@ -29,10 +28,6 @@ Thank you to the following **GIANTS**:

* [github.com/gobuffalo/nulls](https://godoc.org/github.com/gobuffalo/nulls)

* [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd)

* [github.com/gobuffalo/packr/v2](https://godoc.org/github.com/gobuffalo/packr/v2)

* [github.com/gobuffalo/plush](https://godoc.org/github.com/gobuffalo/plush)

* [github.com/gobuffalo/validate](https://godoc.org/github.com/gobuffalo/validate)
Expand All @@ -55,8 +50,6 @@ Thank you to the following **GIANTS**:

* [github.com/mattn/go-sqlite3](https://godoc.org/github.com/mattn/go-sqlite3)

* [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors)

* [github.com/satori/go.uuid](https://godoc.org/github.com/satori/go.uuid)

* [github.com/shopspring/decimal](https://godoc.org/github.com/shopspring/decimal)
Expand Down
2 changes: 1 addition & 1 deletion associations/association.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"

"github.com/gobuffalo/nulls"
"github.com/gobuffalo/pop/v5/columns"
"github.com/gobuffalo/pop/v6/columns"
)

// Association represents a definition of a model association
Expand Down
Loading

0 comments on commit c285511

Please sign in to comment.