fix generated columns in mutable columns for PostgreSQL
Fix https://github.com/go-jet/jet/issues/209.
This commit is contained in:
parent
ce3c622fa4
commit
a4191b4953
6 changed files with 20 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ jet-gen-postgres:
|
|||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=chinook2 -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=northwind -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=test_sample -path=./.gentestdata/
|
||||
jet -dsn=postgres://jet:jet@localhost:50901/jetdb?sslmode=disable -schema=test_generated -path=./.gentestdata/
|
||||
|
||||
jet-gen-mysql:
|
||||
jet -source=mysql -dsn="jet:jet@tcp(localhost:50902)/dvds" -path=./.gentestdata/mysql
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ func initPostgresDB(dbType string, connectionString string) {
|
|||
"test_sample",
|
||||
"chinook",
|
||||
"chinook2",
|
||||
"test_generated",
|
||||
}
|
||||
|
||||
for _, schemaName := range schemaNames {
|
||||
|
|
|
|||
15
tests/postgres/generated_test.go
Normal file
15
tests/postgres/generated_test.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
. "github.com/go-jet/jet/v2/tests/.gentestdata/jetdb/test_generated/table"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMutableColumnsExcludeGeneratedColumn(t *testing.T) {
|
||||
t.Run("should not have the generated column in mutableColumns", func(t *testing.T) {
|
||||
require.Equal(t, 2, len(People.MutableColumns))
|
||||
require.Equal(t, People.PeopleName, People.MutableColumns[0])
|
||||
require.Equal(t, People.PeopleHeightCm, People.MutableColumns[1])
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue