diff --git a/.gitignore b/.gitignore index 2277c6db..b79d3a54 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ _testmain.go .DS_Store +test/*/output diff --git a/Makefile b/Makefile index edd9aca6..31aff197 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,10 @@ install: ## Installs tables-to-go. Same behavior like `go install go install -mod=vendor . test: - go test -race ./... + go test -mod=vendor -race ./... integration-test: - go test -race -tags=integration ./... + go test -mod=vendor -race -tags=integration ./... sqlite3: ## Installs tables-to-go with sqlite3 driver and the \ ## User Authentication feature enabled. \ diff --git a/pkg/database/postgresql.go b/pkg/database/postgresql.go index 1d4290d7..41965d40 100644 --- a/pkg/database/postgresql.go +++ b/pkg/database/postgresql.go @@ -10,11 +10,19 @@ import ( _ "github.com/lib/pq" ) -// Postgresql implemenmts the Database interface with help of generalDatabase +const ( + PostgresqlColumnTypePrimaryKey = "PRIMARY KEY" + PostgresqlColumnTypeAutoIncrement = "nextval" + PostgresqlColumnTypeSerial = "serial" +) + +// Postgresql implements the Database interface with help of generalDatabase type Postgresql struct { *GeneralDatabase defaultUserName string + + integerDataTypes map[string]struct{} } // NewPostgresql creates a new Postgresql database @@ -25,6 +33,21 @@ func NewPostgresql(s *settings.Settings) *Postgresql { driver: dbTypeToDriverMap[s.DbType], }, defaultUserName: "postgres", + + integerDataTypes: map[string]struct{}{ + "smallint": {}, + "int2": {}, + "integer": {}, + "int4": {}, + "bigint": {}, + "int8": {}, + "smallserial": {}, + "serial2": {}, + "serial": {}, + "serial4": {}, + "bigserial": {}, + "serial8": {}, + }, } } @@ -43,7 +66,7 @@ func (pg *Postgresql) DSN() string { pg.Settings.Host, pg.Settings.Port, user, pg.Settings.DbName, pg.Settings.Pswd) } -// GetDriverImportLibrary returns the golang sql driver specific fot the MySQL database +// GetDriverImportLibrary returns the golang sql driver specific fot the Postgres database func (pg *Postgresql) GetDriverImportLibrary() string { return "pg \"github.com/lib/pq\"" } @@ -115,15 +138,15 @@ func (pg *Postgresql) GetColumnsOfTable(table *Table) (err error) { // IsPrimaryKey checks if column belongs to primary key func (pg *Postgresql) IsPrimaryKey(column Column) bool { - return strings.Contains(column.ConstraintType.String, "PRIMARY KEY") + return strings.Contains(column.ConstraintType.String, PostgresqlColumnTypePrimaryKey) } // IsAutoIncrement checks if column is a serial column func (pg *Postgresql) IsAutoIncrement(column Column) bool { - return strings.Contains(column.DefaultValue.String, "nextval") + return strings.Contains(column.DefaultValue.String, PostgresqlColumnTypeAutoIncrement) } -// GetStringDatatypes returns the string datatypes for the postgre database +// GetStringDatatypes returns the string datatypes for the Postgres database func (pg *Postgresql) GetStringDatatypes() []string { return []string{ "character varying", @@ -133,43 +156,48 @@ func (pg *Postgresql) GetStringDatatypes() []string { } } -// IsString returns true if colum is of type string for the postgre database +// IsString returns true if column is of type string for the Postgres database func (pg *Postgresql) IsString(column Column) bool { return pg.IsStringInSlice(column.DataType, pg.GetStringDatatypes()) } -// GetTextDatatypes returns the text datatypes for the postgre database +// GetTextDatatypes returns the text datatypes for the Postgres database func (pg *Postgresql) GetTextDatatypes() []string { return []string{ "text", } } -// IsText returns true if colum is of type text for the postgre database +// IsText returns true if column is of type text for the Postgres database func (pg *Postgresql) IsText(column Column) bool { return pg.IsStringInSlice(column.DataType, pg.GetTextDatatypes()) } -// GetIntegerDatatypes returns the integer datatypes for the postgre database +// GetIntegerDatatypes returns the integer datatypes for the Postgres database +// TODO remove these methods func (pg *Postgresql) GetIntegerDatatypes() []string { return []string{ - "smallint", - "integer", - "bigint", - "smallserial", - "serial", - "bigserial", + "smallint", "int2", + "integer", "int4", + "bigint", "int8", + "smallserial", "serial2", + "serial", "serial4", + "bigserial", "serial8", } } -// IsInteger returns true if colum is of type integer for the postgre database +// IsInteger returns true if column is of type integer for the Postgres database func (pg *Postgresql) IsInteger(column Column) bool { - return pg.IsStringInSlice(column.DataType, pg.GetIntegerDatatypes()) + _, ok := pg.integerDataTypes[column.DataType] + return ok } -// GetFloatDatatypes returns the float datatypes for the postgre database +// GetFloatDatatypes returns the float datatypes for the Postgres database func (pg *Postgresql) GetFloatDatatypes() []string { return []string{ + "float", + "float4", + "float8", "numeric", "decimal", "real", @@ -177,12 +205,12 @@ func (pg *Postgresql) GetFloatDatatypes() []string { } } -// IsFloat returns true if colum is of type float for the postgre database +// IsFloat returns true if column is of type float for the Postgres database func (pg *Postgresql) IsFloat(column Column) bool { return pg.IsStringInSlice(column.DataType, pg.GetFloatDatatypes()) } -// GetTemporalDatatypes returns the temporal datatypes for the postgre database +// GetTemporalDatatypes returns the temporal datatypes for the Postgres database func (pg *Postgresql) GetTemporalDatatypes() []string { return []string{ "time", @@ -195,12 +223,12 @@ func (pg *Postgresql) GetTemporalDatatypes() []string { } } -// IsTemporal returns true if colum is of type temporal for the postgre database +// IsTemporal returns true if column is of type temporal for the Postgres database func (pg *Postgresql) IsTemporal(column Column) bool { return pg.IsStringInSlice(column.DataType, pg.GetTemporalDatatypes()) } -// GetTemporalDriverDataType returns the time data type specific for the postgre database +// GetTemporalDriverDataType returns the time data type specific for the Postgres database func (pg *Postgresql) GetTemporalDriverDataType() string { return "pg.NullTime" } diff --git a/test/integration_test.go b/test/integration_test.go index c96d8238..2c79b8d3 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -10,7 +10,6 @@ import ( "os" "path/filepath" "sort" - "strings" "testing" "time" @@ -24,13 +23,6 @@ import ( "github.com/fraenky8/tables-to-go/pkg/settings" ) -type cliWriter struct{} - -func (c cliWriter) Write(tableName string, content string) error { - _, err := fmt.Println(content) - return err -} - type dbSettings struct { *settings.Settings @@ -80,8 +72,37 @@ func TestIntegration(t *testing.T) { dockerImage: "mysql", version: "8", env: []string{ - "MYSQL_DATABASE=public", - "MYSQL_ROOT_PASSWORD=mysecretpassword", + "MYSQL_DATABASE=" + s.DbName, + "MYSQL_ROOT_PASSWORD=" + s.Pswd, + }, + Settings: s, + } + + dbs.setSettings(s) + + return dbs + }(), + }, + { + desc: "postgres 10", + settings: func() *dbSettings { + s := settings.New() + s.DbType = settings.DbTypePostgresql + s.User = "postgres" + s.Pswd = "mysecretpassword" + s.DbName = "postgres" + s.Schema = "public" + s.Host = "localhost" + s.Port = "5432" + //s.Verbose = true + //s.VVerbose = true + + dbs := &dbSettings{ + dockerImage: "postgres", + version: "10", + env: []string{ + "POSTGRES_DB=" + s.DbName, + "POSTGRES_PASSWORD=" + s.Pswd, }, Settings: s, } @@ -94,7 +115,10 @@ func TestIntegration(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.desc, func(t *testing.T) { + t.Parallel() + s := test.settings db, purgeFn, err := setupDatabase(s) @@ -114,15 +138,17 @@ func TestIntegration(t *testing.T) { // TODO need flag for not removing generated output but // save it into the expected directory - _ = os.RemoveAll(s.Settings.OutputFilePath) - _ = os.MkdirAll(s.Settings.OutputFilePath, 0755) + if !t.Failed() { + _ = os.RemoveAll(s.Settings.OutputFilePath) + } }() - writer := output.NewFileWriter(s.Settings.OutputFilePath) - //writer := cliWriter{} + err = os.MkdirAll(s.Settings.OutputFilePath, 0755) + if err != nil { + t.Fatalf("could not create output file path: %v", err) + } - prefix := strings.Title(s.imageName()) - s.Settings.Prefix = prefix + "_" + writer := output.NewFileWriter(s.Settings.OutputFilePath) err = cli.Run(s.Settings, db, writer) assert.NoError(t, err) @@ -134,28 +160,27 @@ func TestIntegration(t *testing.T) { func checkFiles(t *testing.T, s *dbSettings) { expectedPattern := filepath.Join(s.getExceptedFilepath(), s.Settings.Prefix+"*") - expected, err := filepath.Glob(expectedPattern) + expectedFiles, err := filepath.Glob(expectedPattern) assert.NoError(t, err) actualPattern := filepath.Join(s.Settings.OutputFilePath, s.Settings.Prefix+"*") - actual, err := filepath.Glob(actualPattern) + actualFiles, err := filepath.Glob(actualPattern) assert.NoError(t, err) - if len(expected) != len(actual) { + if len(expectedFiles) != len(actualFiles) { t.Fatalf("expected and actual files differ in length: %v (%d) vs. %v (%d)", - expected, len(expected), actual, len(actual)) + expectedFiles, len(expectedFiles), actualFiles, len(actualFiles)) } - sort.Strings(expected) - sort.Strings(actual) + sort.Strings(expectedFiles) + sort.Strings(actualFiles) - for i, ef := range expected { - af := actual[i] - f1, err := ioutil.ReadFile(ef) + for i := range expectedFiles { + expectedFile, err := ioutil.ReadFile(expectedFiles[i]) assert.NoError(t, err) - f2, err := ioutil.ReadFile(af) + actualFile, err := ioutil.ReadFile(actualFiles[i]) assert.NoError(t, err) - assert.True(t, bytes.Equal(f1, f2)) + assert.Equal(t, expectedFile, actualFile) } } @@ -165,13 +190,13 @@ func setupDatabase(settings *dbSettings) (database.Database, func() error, error if err != nil { return nil, nil, fmt.Errorf("error connecting to Docker: %v", err) } - pool.MaxWait = 2 * time.Minute + pool.MaxWait = 1 * time.Minute resource, err := pool.Run(settings.dockerImage, settings.version, settings.env) if err != nil { return nil, nil, fmt.Errorf("could not start resource: %s", err) } - _ = resource.Expire(60) + _ = resource.Expire(45) purgeFn := func() error { if err := pool.Purge(resource); err != nil { @@ -207,25 +232,31 @@ func setupDatabase(settings *dbSettings) (database.Database, func() error, error } func populateData(db *sqlx.DB, s *dbSettings) error { - // TODO account for multiple SQL files - f := filepath.Join(s.getTestdataFilepath(), s.imageName()+".sql") - data, err := ioutil.ReadFile(f) + dataPattern := filepath.Join(s.getTestdataFilepath(), "*.sql") + files, err := filepath.Glob(dataPattern) if err != nil { - return fmt.Errorf("could not read sql testdata: %v", err) + return fmt.Errorf("could not find sql testdata: %v", err) } - queries := bytes.Split(data, []byte(";")) - - for _, query := range queries { - query = bytes.TrimSpace(query) - q := string(query) - if q == "" { - continue + for _, f := range files { + data, err := ioutil.ReadFile(f) + if err != nil { + return fmt.Errorf("could not read %q: %v", f, err) } - _, err = db.Exec(q) - if err != nil { - return fmt.Errorf("could not insert testdata %q: %v", q, err) + queries := bytes.Split(data, []byte(";")) + + for _, query := range queries { + query = bytes.TrimSpace(query) + q := string(query) + if q == "" { + continue + } + + _, err = db.Exec(q) + if err != nil { + return fmt.Errorf("could not insert testdata %q: %v", q, err) + } } } diff --git a/test/mysql8/expected/Mysql8TestTemporals.go b/test/mysql8/expected/TestTemporals.go similarity index 90% rename from test/mysql8/expected/Mysql8TestTemporals.go rename to test/mysql8/expected/TestTemporals.go index 537b2367..c5de283a 100644 --- a/test/mysql8/expected/Mysql8TestTemporals.go +++ b/test/mysql8/expected/TestTemporals.go @@ -6,7 +6,7 @@ import ( "github.com/go-sql-driver/mysql" ) -type Mysql8TestTemporals struct { +type TestTemporals struct { T mysql.NullTime `db:"t"` TNn time.Time `db:"t_nn"` D mysql.NullTime `db:"d"` diff --git a/test/postgres10/expected/Bigint.go b/test/postgres10/expected/Bigint.go new file mode 100644 index 00000000..c3901f50 --- /dev/null +++ b/test/postgres10/expected/Bigint.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Bigint struct { + Bigint sql.NullInt64 `db:"bigint"` + BigintNn int `db:"bigint_nn"` + BigintNnUnique int `db:"bigint_nn_unique"` + BigintNnCheck int `db:"bigint_nn_check"` + BigintNnRef int `db:"bigint_nn_ref"` + BigintNnDefConst int `db:"bigint_nn_def_const"` + BigintNnDefFunc int `db:"bigint_nn_def_func"` + BigintNnUniqueCheck int `db:"bigint_nn_unique_check"` + BigintUnique sql.NullInt64 `db:"bigint_unique"` + BigintUniqueCheck sql.NullInt64 `db:"bigint_unique_check"` + BigintUniqueRef sql.NullInt64 `db:"bigint_unique_ref"` + BigintUniqueDefConst sql.NullInt64 `db:"bigint_unique_def_const"` + BigintUniqueDefFunc sql.NullInt64 `db:"bigint_unique_def_func"` + BigintCheck sql.NullInt64 `db:"bigint_check"` + BigintCheckRef sql.NullInt64 `db:"bigint_check_ref"` + BigintCheckDefConst sql.NullInt64 `db:"bigint_check_def_const"` + BigintCheckDefFunc sql.NullInt64 `db:"bigint_check_def_func"` + BigintRef sql.NullInt64 `db:"bigint_ref"` + BigintRefDefConst sql.NullInt64 `db:"bigint_ref_def_const"` + BigintRefDefFunc sql.NullInt64 `db:"bigint_ref_def_func"` + BigintRefUniqueCheck sql.NullInt64 `db:"bigint_ref_unique_check"` + BigintDefConst sql.NullInt64 `db:"bigint_def_const"` + BigintDefConstUniqueCheck sql.NullInt64 `db:"bigint_def_const_unique_check"` + BigintDefFunc sql.NullInt64 `db:"bigint_def_func"` + BigintDefFuncUniqueCheck sql.NullInt64 `db:"bigint_def_func_unique_check"` +} diff --git a/test/postgres10/expected/BigintCheckPk.go b/test/postgres10/expected/BigintCheckPk.go new file mode 100644 index 00000000..2474c3d5 --- /dev/null +++ b/test/postgres10/expected/BigintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintCheckPk struct { + BigintCheckPk int `db:"bigint_check_pk"` +} diff --git a/test/postgres10/expected/BigintDefConstUniqueCheckPk.go b/test/postgres10/expected/BigintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..808e31f2 --- /dev/null +++ b/test/postgres10/expected/BigintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPk struct { + BigintDefConstUniqueCheckPk int `db:"bigint_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/BigintDefConstUniqueCheckPkRef.go b/test/postgres10/expected/BigintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..64fcb8c8 --- /dev/null +++ b/test/postgres10/expected/BigintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefConstUniqueCheckPkRef struct { + BigintDefConstUniqueCheckPkRef int `db:"bigint_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/BigintDefFuncUniqueCheckPk.go b/test/postgres10/expected/BigintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..68117369 --- /dev/null +++ b/test/postgres10/expected/BigintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPk struct { + BigintDefFuncUniqueCheckPk int `db:"bigint_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/BigintDefFuncUniqueCheckPkRef.go b/test/postgres10/expected/BigintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..dbd5da9d --- /dev/null +++ b/test/postgres10/expected/BigintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintDefFuncUniqueCheckPkRef struct { + BigintDefFuncUniqueCheckPkRef int `db:"bigint_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/BigintNnPk.go b/test/postgres10/expected/BigintNnPk.go new file mode 100644 index 00000000..f4ddc4aa --- /dev/null +++ b/test/postgres10/expected/BigintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnPk struct { + BigintNnPk int `db:"bigint_nn_pk"` +} diff --git a/test/postgres10/expected/BigintNnUniqueCheckPk.go b/test/postgres10/expected/BigintNnUniqueCheckPk.go new file mode 100644 index 00000000..ce5d15c5 --- /dev/null +++ b/test/postgres10/expected/BigintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPk struct { + BigintNnUniqueCheckPk int `db:"bigint_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/BigintNnUniqueCheckPkRef.go b/test/postgres10/expected/BigintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..4c065777 --- /dev/null +++ b/test/postgres10/expected/BigintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintNnUniqueCheckPkRef struct { + BigintNnUniqueCheckPkRef int `db:"bigint_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/BigintPk.go b/test/postgres10/expected/BigintPk.go new file mode 100644 index 00000000..0b34e55b --- /dev/null +++ b/test/postgres10/expected/BigintPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintPk struct { + BigintPk int `db:"bigint_pk"` +} diff --git a/test/postgres10/expected/BigintPkDefConst.go b/test/postgres10/expected/BigintPkDefConst.go new file mode 100644 index 00000000..08c26cbd --- /dev/null +++ b/test/postgres10/expected/BigintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefConst struct { + BigintPkDefConst int `db:"bigint_pk_def_const"` +} diff --git a/test/postgres10/expected/BigintPkDefFunc.go b/test/postgres10/expected/BigintPkDefFunc.go new file mode 100644 index 00000000..656fadc9 --- /dev/null +++ b/test/postgres10/expected/BigintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkDefFunc struct { + BigintPkDefFunc int `db:"bigint_pk_def_func"` +} diff --git a/test/postgres10/expected/BigintPkRef.go b/test/postgres10/expected/BigintPkRef.go new file mode 100644 index 00000000..21608d8c --- /dev/null +++ b/test/postgres10/expected/BigintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintPkRef struct { + BigintPkRef int `db:"bigint_pk_ref"` +} diff --git a/test/postgres10/expected/BigintRef.go b/test/postgres10/expected/BigintRef.go new file mode 100644 index 00000000..348ad421 --- /dev/null +++ b/test/postgres10/expected/BigintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type BigintRef struct { + BigintRef sql.NullInt64 `db:"bigint_ref"` +} diff --git a/test/postgres10/expected/BigintUniqueCheckPk.go b/test/postgres10/expected/BigintUniqueCheckPk.go new file mode 100644 index 00000000..d2cd0c7e --- /dev/null +++ b/test/postgres10/expected/BigintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPk struct { + BigintUniqueCheckPk int `db:"bigint_unique_check_pk"` +} diff --git a/test/postgres10/expected/BigintUniqueCheckPkRef.go b/test/postgres10/expected/BigintUniqueCheckPkRef.go new file mode 100644 index 00000000..f41b59bf --- /dev/null +++ b/test/postgres10/expected/BigintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniqueCheckPkRef struct { + BigintUniqueCheckPkRef int `db:"bigint_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/BigintUniquePk.go b/test/postgres10/expected/BigintUniquePk.go new file mode 100644 index 00000000..06e50c8e --- /dev/null +++ b/test/postgres10/expected/BigintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type BigintUniquePk struct { + BigintUniquePk int `db:"bigint_unique_pk"` +} diff --git a/test/postgres10/expected/Bigserial.go b/test/postgres10/expected/Bigserial.go new file mode 100644 index 00000000..b7ac1840 --- /dev/null +++ b/test/postgres10/expected/Bigserial.go @@ -0,0 +1,5 @@ +package dto + +type Bigserial struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialCheck.go b/test/postgres10/expected/BigserialCheck.go new file mode 100644 index 00000000..770c067b --- /dev/null +++ b/test/postgres10/expected/BigserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialNotnull.go b/test/postgres10/expected/BigserialNotnull.go new file mode 100644 index 00000000..defb7802 --- /dev/null +++ b/test/postgres10/expected/BigserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type BigserialNotnull struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialPk.go b/test/postgres10/expected/BigserialPk.go new file mode 100644 index 00000000..d494fe60 --- /dev/null +++ b/test/postgres10/expected/BigserialPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialRef.go b/test/postgres10/expected/BigserialRef.go new file mode 100644 index 00000000..0cb6df8c --- /dev/null +++ b/test/postgres10/expected/BigserialRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialRef struct { + BigserialRef int `db:"bigserial_ref"` +} diff --git a/test/postgres10/expected/BigserialReferences.go b/test/postgres10/expected/BigserialReferences.go new file mode 100644 index 00000000..5a8b5d51 --- /dev/null +++ b/test/postgres10/expected/BigserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type BigserialReferences struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialUnique.go b/test/postgres10/expected/BigserialUnique.go new file mode 100644 index 00000000..7884f697 --- /dev/null +++ b/test/postgres10/expected/BigserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUnique struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialUniqueCheck.go b/test/postgres10/expected/BigserialUniqueCheck.go new file mode 100644 index 00000000..aa58bc27 --- /dev/null +++ b/test/postgres10/expected/BigserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheck struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialUniqueCheckPk.go b/test/postgres10/expected/BigserialUniqueCheckPk.go new file mode 100644 index 00000000..5715fff7 --- /dev/null +++ b/test/postgres10/expected/BigserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPk struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialUniqueCheckPkRef.go b/test/postgres10/expected/BigserialUniqueCheckPkRef.go new file mode 100644 index 00000000..c9b0b21f --- /dev/null +++ b/test/postgres10/expected/BigserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckPkRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/BigserialUniqueCheckRef.go b/test/postgres10/expected/BigserialUniqueCheckRef.go new file mode 100644 index 00000000..f12fbe3b --- /dev/null +++ b/test/postgres10/expected/BigserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type BigserialUniqueCheckRef struct { + Bigserial int `db:"bigserial"` +} diff --git a/test/postgres10/expected/Int2.go b/test/postgres10/expected/Int2.go new file mode 100644 index 00000000..6f1ee461 --- /dev/null +++ b/test/postgres10/expected/Int2.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int2 struct { + Int2 sql.NullInt64 `db:"int2"` + Int2Nn int `db:"int2_nn"` + Int2NnUnique int `db:"int2_nn_unique"` + Int2NnCheck int `db:"int2_nn_check"` + Int2NnRef int `db:"int2_nn_ref"` + Int2NnDefConst int `db:"int2_nn_def_const"` + Int2NnDefFunc int `db:"int2_nn_def_func"` + Int2NnUniqueCheck int `db:"int2_nn_unique_check"` + Int2Unique sql.NullInt64 `db:"int2_unique"` + Int2UniqueCheck sql.NullInt64 `db:"int2_unique_check"` + Int2UniqueRef sql.NullInt64 `db:"int2_unique_ref"` + Int2UniqueDefConst sql.NullInt64 `db:"int2_unique_def_const"` + Int2UniqueDefFunc sql.NullInt64 `db:"int2_unique_def_func"` + Int2Check sql.NullInt64 `db:"int2_check"` + Int2CheckRef sql.NullInt64 `db:"int2_check_ref"` + Int2CheckDefConst sql.NullInt64 `db:"int2_check_def_const"` + Int2CheckDefFunc sql.NullInt64 `db:"int2_check_def_func"` + Int2Ref sql.NullInt64 `db:"int2_ref"` + Int2RefDefConst sql.NullInt64 `db:"int2_ref_def_const"` + Int2RefDefFunc sql.NullInt64 `db:"int2_ref_def_func"` + Int2RefUniqueCheck sql.NullInt64 `db:"int2_ref_unique_check"` + Int2DefConst sql.NullInt64 `db:"int2_def_const"` + Int2DefConstUniqueCheck sql.NullInt64 `db:"int2_def_const_unique_check"` + Int2DefFunc sql.NullInt64 `db:"int2_def_func"` + Int2DefFuncUniqueCheck sql.NullInt64 `db:"int2_def_func_unique_check"` +} diff --git a/test/postgres10/expected/Int2CheckPk.go b/test/postgres10/expected/Int2CheckPk.go new file mode 100644 index 00000000..c409012d --- /dev/null +++ b/test/postgres10/expected/Int2CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2CheckPk struct { + Int2CheckPk int `db:"int2_check_pk"` +} diff --git a/test/postgres10/expected/Int2DefConstUniqueCheckPk.go b/test/postgres10/expected/Int2DefConstUniqueCheckPk.go new file mode 100644 index 00000000..772481e0 --- /dev/null +++ b/test/postgres10/expected/Int2DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPk struct { + Int2DefConstUniqueCheckPk int `db:"int2_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int2DefConstUniqueCheckPkRef.go b/test/postgres10/expected/Int2DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..5f1eba0a --- /dev/null +++ b/test/postgres10/expected/Int2DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefConstUniqueCheckPkRef struct { + Int2DefConstUniqueCheckPkRef int `db:"int2_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int2DefFuncUniqueCheckPk.go b/test/postgres10/expected/Int2DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..543fe608 --- /dev/null +++ b/test/postgres10/expected/Int2DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPk struct { + Int2DefFuncUniqueCheckPk int `db:"int2_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int2DefFuncUniqueCheckPkRef.go b/test/postgres10/expected/Int2DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..4920bc81 --- /dev/null +++ b/test/postgres10/expected/Int2DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2DefFuncUniqueCheckPkRef struct { + Int2DefFuncUniqueCheckPkRef int `db:"int2_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int2NnPk.go b/test/postgres10/expected/Int2NnPk.go new file mode 100644 index 00000000..bf785b43 --- /dev/null +++ b/test/postgres10/expected/Int2NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnPk struct { + Int2NnPk int `db:"int2_nn_pk"` +} diff --git a/test/postgres10/expected/Int2NnUniqueCheckPk.go b/test/postgres10/expected/Int2NnUniqueCheckPk.go new file mode 100644 index 00000000..e0418ee3 --- /dev/null +++ b/test/postgres10/expected/Int2NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPk struct { + Int2NnUniqueCheckPk int `db:"int2_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int2NnUniqueCheckPkRef.go b/test/postgres10/expected/Int2NnUniqueCheckPkRef.go new file mode 100644 index 00000000..c4c5061f --- /dev/null +++ b/test/postgres10/expected/Int2NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2NnUniqueCheckPkRef struct { + Int2NnUniqueCheckPkRef int `db:"int2_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int2Pk.go b/test/postgres10/expected/Int2Pk.go new file mode 100644 index 00000000..afaa5495 --- /dev/null +++ b/test/postgres10/expected/Int2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int2Pk struct { + Int2Pk int `db:"int2_pk"` +} diff --git a/test/postgres10/expected/Int2PkDefConst.go b/test/postgres10/expected/Int2PkDefConst.go new file mode 100644 index 00000000..4f11bad2 --- /dev/null +++ b/test/postgres10/expected/Int2PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefConst struct { + Int2PkDefConst int `db:"int2_pk_def_const"` +} diff --git a/test/postgres10/expected/Int2PkDefFunc.go b/test/postgres10/expected/Int2PkDefFunc.go new file mode 100644 index 00000000..a81ce4b5 --- /dev/null +++ b/test/postgres10/expected/Int2PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkDefFunc struct { + Int2PkDefFunc int `db:"int2_pk_def_func"` +} diff --git a/test/postgres10/expected/Int2PkRef.go b/test/postgres10/expected/Int2PkRef.go new file mode 100644 index 00000000..8503dd8e --- /dev/null +++ b/test/postgres10/expected/Int2PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2PkRef struct { + Int2PkRef int `db:"int2_pk_ref"` +} diff --git a/test/postgres10/expected/Int2Ref.go b/test/postgres10/expected/Int2Ref.go new file mode 100644 index 00000000..339c8757 --- /dev/null +++ b/test/postgres10/expected/Int2Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int2Ref struct { + Int2Ref sql.NullInt64 `db:"int2_ref"` +} diff --git a/test/postgres10/expected/Int2UniqueCheckPk.go b/test/postgres10/expected/Int2UniqueCheckPk.go new file mode 100644 index 00000000..7f2e43df --- /dev/null +++ b/test/postgres10/expected/Int2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPk struct { + Int2UniqueCheckPk int `db:"int2_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int2UniqueCheckPkRef.go b/test/postgres10/expected/Int2UniqueCheckPkRef.go new file mode 100644 index 00000000..8a988d5a --- /dev/null +++ b/test/postgres10/expected/Int2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniqueCheckPkRef struct { + Int2UniqueCheckPkRef int `db:"int2_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int2UniquePk.go b/test/postgres10/expected/Int2UniquePk.go new file mode 100644 index 00000000..6b3535ad --- /dev/null +++ b/test/postgres10/expected/Int2UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int2UniquePk struct { + Int2UniquePk int `db:"int2_unique_pk"` +} diff --git a/test/postgres10/expected/Int4.go b/test/postgres10/expected/Int4.go new file mode 100644 index 00000000..6d869c16 --- /dev/null +++ b/test/postgres10/expected/Int4.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int4 struct { + Int4 sql.NullInt64 `db:"int4"` + Int4Nn int `db:"int4_nn"` + Int4NnUnique int `db:"int4_nn_unique"` + Int4NnCheck int `db:"int4_nn_check"` + Int4NnRef int `db:"int4_nn_ref"` + Int4NnDefConst int `db:"int4_nn_def_const"` + Int4NnDefFunc int `db:"int4_nn_def_func"` + Int4NnUniqueCheck int `db:"int4_nn_unique_check"` + Int4Unique sql.NullInt64 `db:"int4_unique"` + Int4UniqueCheck sql.NullInt64 `db:"int4_unique_check"` + Int4UniqueRef sql.NullInt64 `db:"int4_unique_ref"` + Int4UniqueDefConst sql.NullInt64 `db:"int4_unique_def_const"` + Int4UniqueDefFunc sql.NullInt64 `db:"int4_unique_def_func"` + Int4Check sql.NullInt64 `db:"int4_check"` + Int4CheckRef sql.NullInt64 `db:"int4_check_ref"` + Int4CheckDefConst sql.NullInt64 `db:"int4_check_def_const"` + Int4CheckDefFunc sql.NullInt64 `db:"int4_check_def_func"` + Int4Ref sql.NullInt64 `db:"int4_ref"` + Int4RefDefConst sql.NullInt64 `db:"int4_ref_def_const"` + Int4RefDefFunc sql.NullInt64 `db:"int4_ref_def_func"` + Int4RefUniqueCheck sql.NullInt64 `db:"int4_ref_unique_check"` + Int4DefConst sql.NullInt64 `db:"int4_def_const"` + Int4DefConstUniqueCheck sql.NullInt64 `db:"int4_def_const_unique_check"` + Int4DefFunc sql.NullInt64 `db:"int4_def_func"` + Int4DefFuncUniqueCheck sql.NullInt64 `db:"int4_def_func_unique_check"` +} diff --git a/test/postgres10/expected/Int4CheckPk.go b/test/postgres10/expected/Int4CheckPk.go new file mode 100644 index 00000000..49c85faa --- /dev/null +++ b/test/postgres10/expected/Int4CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4CheckPk struct { + Int4CheckPk int `db:"int4_check_pk"` +} diff --git a/test/postgres10/expected/Int4DefConstUniqueCheckPk.go b/test/postgres10/expected/Int4DefConstUniqueCheckPk.go new file mode 100644 index 00000000..a355bb5b --- /dev/null +++ b/test/postgres10/expected/Int4DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPk struct { + Int4DefConstUniqueCheckPk int `db:"int4_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int4DefConstUniqueCheckPkRef.go b/test/postgres10/expected/Int4DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3090d90d --- /dev/null +++ b/test/postgres10/expected/Int4DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefConstUniqueCheckPkRef struct { + Int4DefConstUniqueCheckPkRef int `db:"int4_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int4DefFuncUniqueCheckPk.go b/test/postgres10/expected/Int4DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..bff8c96e --- /dev/null +++ b/test/postgres10/expected/Int4DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPk struct { + Int4DefFuncUniqueCheckPk int `db:"int4_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int4DefFuncUniqueCheckPkRef.go b/test/postgres10/expected/Int4DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3a5fca6c --- /dev/null +++ b/test/postgres10/expected/Int4DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4DefFuncUniqueCheckPkRef struct { + Int4DefFuncUniqueCheckPkRef int `db:"int4_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int4NnPk.go b/test/postgres10/expected/Int4NnPk.go new file mode 100644 index 00000000..8f874f74 --- /dev/null +++ b/test/postgres10/expected/Int4NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnPk struct { + Int4NnPk int `db:"int4_nn_pk"` +} diff --git a/test/postgres10/expected/Int4NnUniqueCheckPk.go b/test/postgres10/expected/Int4NnUniqueCheckPk.go new file mode 100644 index 00000000..6367e902 --- /dev/null +++ b/test/postgres10/expected/Int4NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPk struct { + Int4NnUniqueCheckPk int `db:"int4_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int4NnUniqueCheckPkRef.go b/test/postgres10/expected/Int4NnUniqueCheckPkRef.go new file mode 100644 index 00000000..78c405e5 --- /dev/null +++ b/test/postgres10/expected/Int4NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4NnUniqueCheckPkRef struct { + Int4NnUniqueCheckPkRef int `db:"int4_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int4Pk.go b/test/postgres10/expected/Int4Pk.go new file mode 100644 index 00000000..f7924a64 --- /dev/null +++ b/test/postgres10/expected/Int4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int4Pk struct { + Int4Pk int `db:"int4_pk"` +} diff --git a/test/postgres10/expected/Int4PkDefConst.go b/test/postgres10/expected/Int4PkDefConst.go new file mode 100644 index 00000000..aea720b4 --- /dev/null +++ b/test/postgres10/expected/Int4PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefConst struct { + Int4PkDefConst int `db:"int4_pk_def_const"` +} diff --git a/test/postgres10/expected/Int4PkDefFunc.go b/test/postgres10/expected/Int4PkDefFunc.go new file mode 100644 index 00000000..0336d90a --- /dev/null +++ b/test/postgres10/expected/Int4PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkDefFunc struct { + Int4PkDefFunc int `db:"int4_pk_def_func"` +} diff --git a/test/postgres10/expected/Int4PkRef.go b/test/postgres10/expected/Int4PkRef.go new file mode 100644 index 00000000..a6cf4d57 --- /dev/null +++ b/test/postgres10/expected/Int4PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4PkRef struct { + Int4PkRef int `db:"int4_pk_ref"` +} diff --git a/test/postgres10/expected/Int4Ref.go b/test/postgres10/expected/Int4Ref.go new file mode 100644 index 00000000..469b7498 --- /dev/null +++ b/test/postgres10/expected/Int4Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int4Ref struct { + Int4Ref sql.NullInt64 `db:"int4_ref"` +} diff --git a/test/postgres10/expected/Int4UniqueCheckPk.go b/test/postgres10/expected/Int4UniqueCheckPk.go new file mode 100644 index 00000000..36a0c899 --- /dev/null +++ b/test/postgres10/expected/Int4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPk struct { + Int4UniqueCheckPk int `db:"int4_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int4UniqueCheckPkRef.go b/test/postgres10/expected/Int4UniqueCheckPkRef.go new file mode 100644 index 00000000..b47a5879 --- /dev/null +++ b/test/postgres10/expected/Int4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniqueCheckPkRef struct { + Int4UniqueCheckPkRef int `db:"int4_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int4UniquePk.go b/test/postgres10/expected/Int4UniquePk.go new file mode 100644 index 00000000..f716106b --- /dev/null +++ b/test/postgres10/expected/Int4UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int4UniquePk struct { + Int4UniquePk int `db:"int4_unique_pk"` +} diff --git a/test/postgres10/expected/Int8.go b/test/postgres10/expected/Int8.go new file mode 100644 index 00000000..7b2b4244 --- /dev/null +++ b/test/postgres10/expected/Int8.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Int8 struct { + Int8 sql.NullInt64 `db:"int8"` + Int8Nn int `db:"int8_nn"` + Int8NnUnique int `db:"int8_nn_unique"` + Int8NnCheck int `db:"int8_nn_check"` + Int8NnRef int `db:"int8_nn_ref"` + Int8NnDefConst int `db:"int8_nn_def_const"` + Int8NnDefFunc int `db:"int8_nn_def_func"` + Int8NnUniqueCheck int `db:"int8_nn_unique_check"` + Int8Unique sql.NullInt64 `db:"int8_unique"` + Int8UniqueCheck sql.NullInt64 `db:"int8_unique_check"` + Int8UniqueRef sql.NullInt64 `db:"int8_unique_ref"` + Int8UniqueDefConst sql.NullInt64 `db:"int8_unique_def_const"` + Int8UniqueDefFunc sql.NullInt64 `db:"int8_unique_def_func"` + Int8Check sql.NullInt64 `db:"int8_check"` + Int8CheckRef sql.NullInt64 `db:"int8_check_ref"` + Int8CheckDefConst sql.NullInt64 `db:"int8_check_def_const"` + Int8CheckDefFunc sql.NullInt64 `db:"int8_check_def_func"` + Int8Ref sql.NullInt64 `db:"int8_ref"` + Int8RefDefConst sql.NullInt64 `db:"int8_ref_def_const"` + Int8RefDefFunc sql.NullInt64 `db:"int8_ref_def_func"` + Int8RefUniqueCheck sql.NullInt64 `db:"int8_ref_unique_check"` + Int8DefConst sql.NullInt64 `db:"int8_def_const"` + Int8DefConstUniqueCheck sql.NullInt64 `db:"int8_def_const_unique_check"` + Int8DefFunc sql.NullInt64 `db:"int8_def_func"` + Int8DefFuncUniqueCheck sql.NullInt64 `db:"int8_def_func_unique_check"` +} diff --git a/test/postgres10/expected/Int8CheckPk.go b/test/postgres10/expected/Int8CheckPk.go new file mode 100644 index 00000000..778aaa36 --- /dev/null +++ b/test/postgres10/expected/Int8CheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8CheckPk struct { + Int8CheckPk int `db:"int8_check_pk"` +} diff --git a/test/postgres10/expected/Int8DefConstUniqueCheckPk.go b/test/postgres10/expected/Int8DefConstUniqueCheckPk.go new file mode 100644 index 00000000..201fb0a9 --- /dev/null +++ b/test/postgres10/expected/Int8DefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPk struct { + Int8DefConstUniqueCheckPk int `db:"int8_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int8DefConstUniqueCheckPkRef.go b/test/postgres10/expected/Int8DefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..caf8b85e --- /dev/null +++ b/test/postgres10/expected/Int8DefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefConstUniqueCheckPkRef struct { + Int8DefConstUniqueCheckPkRef int `db:"int8_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int8DefFuncUniqueCheckPk.go b/test/postgres10/expected/Int8DefFuncUniqueCheckPk.go new file mode 100644 index 00000000..c77123a4 --- /dev/null +++ b/test/postgres10/expected/Int8DefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPk struct { + Int8DefFuncUniqueCheckPk int `db:"int8_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int8DefFuncUniqueCheckPkRef.go b/test/postgres10/expected/Int8DefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..a0f68b8d --- /dev/null +++ b/test/postgres10/expected/Int8DefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8DefFuncUniqueCheckPkRef struct { + Int8DefFuncUniqueCheckPkRef int `db:"int8_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int8NnPk.go b/test/postgres10/expected/Int8NnPk.go new file mode 100644 index 00000000..9d31270b --- /dev/null +++ b/test/postgres10/expected/Int8NnPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnPk struct { + Int8NnPk int `db:"int8_nn_pk"` +} diff --git a/test/postgres10/expected/Int8NnUniqueCheckPk.go b/test/postgres10/expected/Int8NnUniqueCheckPk.go new file mode 100644 index 00000000..1758577b --- /dev/null +++ b/test/postgres10/expected/Int8NnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPk struct { + Int8NnUniqueCheckPk int `db:"int8_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int8NnUniqueCheckPkRef.go b/test/postgres10/expected/Int8NnUniqueCheckPkRef.go new file mode 100644 index 00000000..018cde2d --- /dev/null +++ b/test/postgres10/expected/Int8NnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8NnUniqueCheckPkRef struct { + Int8NnUniqueCheckPkRef int `db:"int8_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int8Pk.go b/test/postgres10/expected/Int8Pk.go new file mode 100644 index 00000000..4b09f0a7 --- /dev/null +++ b/test/postgres10/expected/Int8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Int8Pk struct { + Int8Pk int `db:"int8_pk"` +} diff --git a/test/postgres10/expected/Int8PkDefConst.go b/test/postgres10/expected/Int8PkDefConst.go new file mode 100644 index 00000000..35d13ea4 --- /dev/null +++ b/test/postgres10/expected/Int8PkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefConst struct { + Int8PkDefConst int `db:"int8_pk_def_const"` +} diff --git a/test/postgres10/expected/Int8PkDefFunc.go b/test/postgres10/expected/Int8PkDefFunc.go new file mode 100644 index 00000000..2a833393 --- /dev/null +++ b/test/postgres10/expected/Int8PkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkDefFunc struct { + Int8PkDefFunc int `db:"int8_pk_def_func"` +} diff --git a/test/postgres10/expected/Int8PkRef.go b/test/postgres10/expected/Int8PkRef.go new file mode 100644 index 00000000..4d4d7e1b --- /dev/null +++ b/test/postgres10/expected/Int8PkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8PkRef struct { + Int8PkRef int `db:"int8_pk_ref"` +} diff --git a/test/postgres10/expected/Int8Ref.go b/test/postgres10/expected/Int8Ref.go new file mode 100644 index 00000000..792abd77 --- /dev/null +++ b/test/postgres10/expected/Int8Ref.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type Int8Ref struct { + Int8Ref sql.NullInt64 `db:"int8_ref"` +} diff --git a/test/postgres10/expected/Int8UniqueCheckPk.go b/test/postgres10/expected/Int8UniqueCheckPk.go new file mode 100644 index 00000000..12ac4b27 --- /dev/null +++ b/test/postgres10/expected/Int8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPk struct { + Int8UniqueCheckPk int `db:"int8_unique_check_pk"` +} diff --git a/test/postgres10/expected/Int8UniqueCheckPkRef.go b/test/postgres10/expected/Int8UniqueCheckPkRef.go new file mode 100644 index 00000000..7f3d06c7 --- /dev/null +++ b/test/postgres10/expected/Int8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniqueCheckPkRef struct { + Int8UniqueCheckPkRef int `db:"int8_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/Int8UniquePk.go b/test/postgres10/expected/Int8UniquePk.go new file mode 100644 index 00000000..e66c4bb2 --- /dev/null +++ b/test/postgres10/expected/Int8UniquePk.go @@ -0,0 +1,5 @@ +package dto + +type Int8UniquePk struct { + Int8UniquePk int `db:"int8_unique_pk"` +} diff --git a/test/postgres10/expected/Integer.go b/test/postgres10/expected/Integer.go new file mode 100644 index 00000000..f41b6051 --- /dev/null +++ b/test/postgres10/expected/Integer.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Integer struct { + Integer sql.NullInt64 `db:"integer"` + IntegerNn int `db:"integer_nn"` + IntegerNnUnique int `db:"integer_nn_unique"` + IntegerNnCheck int `db:"integer_nn_check"` + IntegerNnRef int `db:"integer_nn_ref"` + IntegerNnDefConst int `db:"integer_nn_def_const"` + IntegerNnDefFunc int `db:"integer_nn_def_func"` + IntegerNnUniqueCheck int `db:"integer_nn_unique_check"` + IntegerUnique sql.NullInt64 `db:"integer_unique"` + IntegerUniqueCheck sql.NullInt64 `db:"integer_unique_check"` + IntegerUniqueRef sql.NullInt64 `db:"integer_unique_ref"` + IntegerUniqueDefConst sql.NullInt64 `db:"integer_unique_def_const"` + IntegerUniqueDefFunc sql.NullInt64 `db:"integer_unique_def_func"` + IntegerCheck sql.NullInt64 `db:"integer_check"` + IntegerCheckRef sql.NullInt64 `db:"integer_check_ref"` + IntegerCheckDefConst sql.NullInt64 `db:"integer_check_def_const"` + IntegerCheckDefFunc sql.NullInt64 `db:"integer_check_def_func"` + IntegerRef sql.NullInt64 `db:"integer_ref"` + IntegerRefDefConst sql.NullInt64 `db:"integer_ref_def_const"` + IntegerRefDefFunc sql.NullInt64 `db:"integer_ref_def_func"` + IntegerRefUniqueCheck sql.NullInt64 `db:"integer_ref_unique_check"` + IntegerDefConst sql.NullInt64 `db:"integer_def_const"` + IntegerDefConstUniqueCheck sql.NullInt64 `db:"integer_def_const_unique_check"` + IntegerDefFunc sql.NullInt64 `db:"integer_def_func"` + IntegerDefFuncUniqueCheck sql.NullInt64 `db:"integer_def_func_unique_check"` +} diff --git a/test/postgres10/expected/IntegerCheckPk.go b/test/postgres10/expected/IntegerCheckPk.go new file mode 100644 index 00000000..ad7c9d02 --- /dev/null +++ b/test/postgres10/expected/IntegerCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerCheckPk struct { + IntegerCheckPk int `db:"integer_check_pk"` +} diff --git a/test/postgres10/expected/IntegerDefConstUniqueCheckPk.go b/test/postgres10/expected/IntegerDefConstUniqueCheckPk.go new file mode 100644 index 00000000..72165e92 --- /dev/null +++ b/test/postgres10/expected/IntegerDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPk struct { + IntegerDefConstUniqueCheckPk int `db:"integer_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/IntegerDefConstUniqueCheckPkRef.go b/test/postgres10/expected/IntegerDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..3345b997 --- /dev/null +++ b/test/postgres10/expected/IntegerDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefConstUniqueCheckPkRef struct { + IntegerDefConstUniqueCheckPkRef int `db:"integer_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/IntegerDefFuncUniqueCheckPk.go b/test/postgres10/expected/IntegerDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..842dc704 --- /dev/null +++ b/test/postgres10/expected/IntegerDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPk struct { + IntegerDefFuncUniqueCheckPk int `db:"integer_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/IntegerDefFuncUniqueCheckPkRef.go b/test/postgres10/expected/IntegerDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..8f406218 --- /dev/null +++ b/test/postgres10/expected/IntegerDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerDefFuncUniqueCheckPkRef struct { + IntegerDefFuncUniqueCheckPkRef int `db:"integer_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/IntegerNnPk.go b/test/postgres10/expected/IntegerNnPk.go new file mode 100644 index 00000000..2ec86875 --- /dev/null +++ b/test/postgres10/expected/IntegerNnPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnPk struct { + IntegerNnPk int `db:"integer_nn_pk"` +} diff --git a/test/postgres10/expected/IntegerNnUniqueCheckPk.go b/test/postgres10/expected/IntegerNnUniqueCheckPk.go new file mode 100644 index 00000000..f9311f0e --- /dev/null +++ b/test/postgres10/expected/IntegerNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPk struct { + IntegerNnUniqueCheckPk int `db:"integer_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/IntegerNnUniqueCheckPkRef.go b/test/postgres10/expected/IntegerNnUniqueCheckPkRef.go new file mode 100644 index 00000000..9dca594a --- /dev/null +++ b/test/postgres10/expected/IntegerNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerNnUniqueCheckPkRef struct { + IntegerNnUniqueCheckPkRef int `db:"integer_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/IntegerPk.go b/test/postgres10/expected/IntegerPk.go new file mode 100644 index 00000000..4ad7290a --- /dev/null +++ b/test/postgres10/expected/IntegerPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPk struct { + IntegerPk int `db:"integer_pk"` +} diff --git a/test/postgres10/expected/IntegerPkDefConst.go b/test/postgres10/expected/IntegerPkDefConst.go new file mode 100644 index 00000000..16ca6af6 --- /dev/null +++ b/test/postgres10/expected/IntegerPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefConst struct { + IntegerPkDefConst int `db:"integer_pk_def_const"` +} diff --git a/test/postgres10/expected/IntegerPkDefFunc.go b/test/postgres10/expected/IntegerPkDefFunc.go new file mode 100644 index 00000000..902032a0 --- /dev/null +++ b/test/postgres10/expected/IntegerPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkDefFunc struct { + IntegerPkDefFunc int `db:"integer_pk_def_func"` +} diff --git a/test/postgres10/expected/IntegerPkRef.go b/test/postgres10/expected/IntegerPkRef.go new file mode 100644 index 00000000..4b526720 --- /dev/null +++ b/test/postgres10/expected/IntegerPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerPkRef struct { + IntegerPkRef int `db:"integer_pk_ref"` +} diff --git a/test/postgres10/expected/IntegerRef.go b/test/postgres10/expected/IntegerRef.go new file mode 100644 index 00000000..0c130331 --- /dev/null +++ b/test/postgres10/expected/IntegerRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type IntegerRef struct { + IntegerRef sql.NullInt64 `db:"integer_ref"` +} diff --git a/test/postgres10/expected/IntegerUniqueCheckPk.go b/test/postgres10/expected/IntegerUniqueCheckPk.go new file mode 100644 index 00000000..e9752b8b --- /dev/null +++ b/test/postgres10/expected/IntegerUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPk struct { + IntegerUniqueCheckPk int `db:"integer_unique_check_pk"` +} diff --git a/test/postgres10/expected/IntegerUniqueCheckPkRef.go b/test/postgres10/expected/IntegerUniqueCheckPkRef.go new file mode 100644 index 00000000..23ec56d9 --- /dev/null +++ b/test/postgres10/expected/IntegerUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniqueCheckPkRef struct { + IntegerUniqueCheckPkRef int `db:"integer_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/IntegerUniquePk.go b/test/postgres10/expected/IntegerUniquePk.go new file mode 100644 index 00000000..460e2616 --- /dev/null +++ b/test/postgres10/expected/IntegerUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type IntegerUniquePk struct { + IntegerUniquePk int `db:"integer_unique_pk"` +} diff --git a/test/postgres10/expected/Serial.go b/test/postgres10/expected/Serial.go new file mode 100644 index 00000000..074fa24a --- /dev/null +++ b/test/postgres10/expected/Serial.go @@ -0,0 +1,5 @@ +package dto + +type Serial struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/Serial2.go b/test/postgres10/expected/Serial2.go new file mode 100644 index 00000000..65429d08 --- /dev/null +++ b/test/postgres10/expected/Serial2.go @@ -0,0 +1,5 @@ +package dto + +type Serial2 struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2Check.go b/test/postgres10/expected/Serial2Check.go new file mode 100644 index 00000000..983eebf1 --- /dev/null +++ b/test/postgres10/expected/Serial2Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Check struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2Notnull.go b/test/postgres10/expected/Serial2Notnull.go new file mode 100644 index 00000000..ae42f28b --- /dev/null +++ b/test/postgres10/expected/Serial2Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Notnull struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2Pk.go b/test/postgres10/expected/Serial2Pk.go new file mode 100644 index 00000000..f8319410 --- /dev/null +++ b/test/postgres10/expected/Serial2Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Pk struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2Ref.go b/test/postgres10/expected/Serial2Ref.go new file mode 100644 index 00000000..fdc79172 --- /dev/null +++ b/test/postgres10/expected/Serial2Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Ref struct { + Serial2Ref int `db:"serial2_ref"` +} diff --git a/test/postgres10/expected/Serial2References.go b/test/postgres10/expected/Serial2References.go new file mode 100644 index 00000000..44b654ea --- /dev/null +++ b/test/postgres10/expected/Serial2References.go @@ -0,0 +1,5 @@ +package dto + +type Serial2References struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2Unique.go b/test/postgres10/expected/Serial2Unique.go new file mode 100644 index 00000000..30253e13 --- /dev/null +++ b/test/postgres10/expected/Serial2Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial2Unique struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2UniqueCheck.go b/test/postgres10/expected/Serial2UniqueCheck.go new file mode 100644 index 00000000..a446a09b --- /dev/null +++ b/test/postgres10/expected/Serial2UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheck struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2UniqueCheckPk.go b/test/postgres10/expected/Serial2UniqueCheckPk.go new file mode 100644 index 00000000..3b802b6d --- /dev/null +++ b/test/postgres10/expected/Serial2UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPk struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2UniqueCheckPkRef.go b/test/postgres10/expected/Serial2UniqueCheckPkRef.go new file mode 100644 index 00000000..4c9947dd --- /dev/null +++ b/test/postgres10/expected/Serial2UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckPkRef struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial2UniqueCheckRef.go b/test/postgres10/expected/Serial2UniqueCheckRef.go new file mode 100644 index 00000000..ddac5722 --- /dev/null +++ b/test/postgres10/expected/Serial2UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial2UniqueCheckRef struct { + Serial2 int `db:"serial2"` +} diff --git a/test/postgres10/expected/Serial4.go b/test/postgres10/expected/Serial4.go new file mode 100644 index 00000000..fbb8ec97 --- /dev/null +++ b/test/postgres10/expected/Serial4.go @@ -0,0 +1,5 @@ +package dto + +type Serial4 struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4Check.go b/test/postgres10/expected/Serial4Check.go new file mode 100644 index 00000000..149274fc --- /dev/null +++ b/test/postgres10/expected/Serial4Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Check struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4Notnull.go b/test/postgres10/expected/Serial4Notnull.go new file mode 100644 index 00000000..02d59de8 --- /dev/null +++ b/test/postgres10/expected/Serial4Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Notnull struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4Pk.go b/test/postgres10/expected/Serial4Pk.go new file mode 100644 index 00000000..78956c15 --- /dev/null +++ b/test/postgres10/expected/Serial4Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Pk struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4Ref.go b/test/postgres10/expected/Serial4Ref.go new file mode 100644 index 00000000..d93b7703 --- /dev/null +++ b/test/postgres10/expected/Serial4Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Ref struct { + Serial4Ref int `db:"serial4_ref"` +} diff --git a/test/postgres10/expected/Serial4References.go b/test/postgres10/expected/Serial4References.go new file mode 100644 index 00000000..1244033d --- /dev/null +++ b/test/postgres10/expected/Serial4References.go @@ -0,0 +1,5 @@ +package dto + +type Serial4References struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4Unique.go b/test/postgres10/expected/Serial4Unique.go new file mode 100644 index 00000000..4ebcf67f --- /dev/null +++ b/test/postgres10/expected/Serial4Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial4Unique struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4UniqueCheck.go b/test/postgres10/expected/Serial4UniqueCheck.go new file mode 100644 index 00000000..2636dccb --- /dev/null +++ b/test/postgres10/expected/Serial4UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheck struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4UniqueCheckPk.go b/test/postgres10/expected/Serial4UniqueCheckPk.go new file mode 100644 index 00000000..edf8f9f9 --- /dev/null +++ b/test/postgres10/expected/Serial4UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPk struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4UniqueCheckPkRef.go b/test/postgres10/expected/Serial4UniqueCheckPkRef.go new file mode 100644 index 00000000..d7a844eb --- /dev/null +++ b/test/postgres10/expected/Serial4UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckPkRef struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial4UniqueCheckRef.go b/test/postgres10/expected/Serial4UniqueCheckRef.go new file mode 100644 index 00000000..2fb663b8 --- /dev/null +++ b/test/postgres10/expected/Serial4UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial4UniqueCheckRef struct { + Serial4 int `db:"serial4"` +} diff --git a/test/postgres10/expected/Serial8.go b/test/postgres10/expected/Serial8.go new file mode 100644 index 00000000..5b06a4ce --- /dev/null +++ b/test/postgres10/expected/Serial8.go @@ -0,0 +1,5 @@ +package dto + +type Serial8 struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8Check.go b/test/postgres10/expected/Serial8Check.go new file mode 100644 index 00000000..526054e4 --- /dev/null +++ b/test/postgres10/expected/Serial8Check.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Check struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8Notnull.go b/test/postgres10/expected/Serial8Notnull.go new file mode 100644 index 00000000..d9d87b15 --- /dev/null +++ b/test/postgres10/expected/Serial8Notnull.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Notnull struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8Pk.go b/test/postgres10/expected/Serial8Pk.go new file mode 100644 index 00000000..3ea4311d --- /dev/null +++ b/test/postgres10/expected/Serial8Pk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Pk struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8Ref.go b/test/postgres10/expected/Serial8Ref.go new file mode 100644 index 00000000..d2de2658 --- /dev/null +++ b/test/postgres10/expected/Serial8Ref.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Ref struct { + Serial8Ref int `db:"serial8_ref"` +} diff --git a/test/postgres10/expected/Serial8References.go b/test/postgres10/expected/Serial8References.go new file mode 100644 index 00000000..2586c9ca --- /dev/null +++ b/test/postgres10/expected/Serial8References.go @@ -0,0 +1,5 @@ +package dto + +type Serial8References struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8Unique.go b/test/postgres10/expected/Serial8Unique.go new file mode 100644 index 00000000..d912158c --- /dev/null +++ b/test/postgres10/expected/Serial8Unique.go @@ -0,0 +1,5 @@ +package dto + +type Serial8Unique struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8UniqueCheck.go b/test/postgres10/expected/Serial8UniqueCheck.go new file mode 100644 index 00000000..352e5651 --- /dev/null +++ b/test/postgres10/expected/Serial8UniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheck struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8UniqueCheckPk.go b/test/postgres10/expected/Serial8UniqueCheckPk.go new file mode 100644 index 00000000..14d4c662 --- /dev/null +++ b/test/postgres10/expected/Serial8UniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPk struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8UniqueCheckPkRef.go b/test/postgres10/expected/Serial8UniqueCheckPkRef.go new file mode 100644 index 00000000..181b67c6 --- /dev/null +++ b/test/postgres10/expected/Serial8UniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckPkRef struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/Serial8UniqueCheckRef.go b/test/postgres10/expected/Serial8UniqueCheckRef.go new file mode 100644 index 00000000..0421b751 --- /dev/null +++ b/test/postgres10/expected/Serial8UniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type Serial8UniqueCheckRef struct { + Serial8 int `db:"serial8"` +} diff --git a/test/postgres10/expected/SerialCheck.go b/test/postgres10/expected/SerialCheck.go new file mode 100644 index 00000000..eda36e57 --- /dev/null +++ b/test/postgres10/expected/SerialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialCheck struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialNotnull.go b/test/postgres10/expected/SerialNotnull.go new file mode 100644 index 00000000..71503aac --- /dev/null +++ b/test/postgres10/expected/SerialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SerialNotnull struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialPk.go b/test/postgres10/expected/SerialPk.go new file mode 100644 index 00000000..38e98376 --- /dev/null +++ b/test/postgres10/expected/SerialPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialPk struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialRef.go b/test/postgres10/expected/SerialRef.go new file mode 100644 index 00000000..4e00e64c --- /dev/null +++ b/test/postgres10/expected/SerialRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialRef struct { + SerialRef int `db:"serial_ref"` +} diff --git a/test/postgres10/expected/SerialReferences.go b/test/postgres10/expected/SerialReferences.go new file mode 100644 index 00000000..db60a6c6 --- /dev/null +++ b/test/postgres10/expected/SerialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SerialReferences struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialUnique.go b/test/postgres10/expected/SerialUnique.go new file mode 100644 index 00000000..6f485376 --- /dev/null +++ b/test/postgres10/expected/SerialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SerialUnique struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialUniqueCheck.go b/test/postgres10/expected/SerialUniqueCheck.go new file mode 100644 index 00000000..84598f1d --- /dev/null +++ b/test/postgres10/expected/SerialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheck struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialUniqueCheckPk.go b/test/postgres10/expected/SerialUniqueCheckPk.go new file mode 100644 index 00000000..ac7ae766 --- /dev/null +++ b/test/postgres10/expected/SerialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPk struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialUniqueCheckPkRef.go b/test/postgres10/expected/SerialUniqueCheckPkRef.go new file mode 100644 index 00000000..7a422f6e --- /dev/null +++ b/test/postgres10/expected/SerialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckPkRef struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/SerialUniqueCheckRef.go b/test/postgres10/expected/SerialUniqueCheckRef.go new file mode 100644 index 00000000..ddadb8ff --- /dev/null +++ b/test/postgres10/expected/SerialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SerialUniqueCheckRef struct { + Serial int `db:"serial"` +} diff --git a/test/postgres10/expected/Smallint.go b/test/postgres10/expected/Smallint.go new file mode 100644 index 00000000..bdd10f42 --- /dev/null +++ b/test/postgres10/expected/Smallint.go @@ -0,0 +1,33 @@ +package dto + +import ( + "database/sql" +) + +type Smallint struct { + Smallint sql.NullInt64 `db:"smallint"` + SmallintNn int `db:"smallint_nn"` + SmallintNnUnique int `db:"smallint_nn_unique"` + SmallintNnCheck int `db:"smallint_nn_check"` + SmallintNnRef int `db:"smallint_nn_ref"` + SmallintNnDefConst int `db:"smallint_nn_def_const"` + SmallintNnDefFunc int `db:"smallint_nn_def_func"` + SmallintNnUniqueCheck int `db:"smallint_nn_unique_check"` + SmallintUnique sql.NullInt64 `db:"smallint_unique"` + SmallintUniqueCheck sql.NullInt64 `db:"smallint_unique_check"` + SmallintUniqueRef sql.NullInt64 `db:"smallint_unique_ref"` + SmallintUniqueDefConst sql.NullInt64 `db:"smallint_unique_def_const"` + SmallintUniqueDefFunc sql.NullInt64 `db:"smallint_unique_def_func"` + SmallintCheck sql.NullInt64 `db:"smallint_check"` + SmallintCheckRef sql.NullInt64 `db:"smallint_check_ref"` + SmallintCheckDefConst sql.NullInt64 `db:"smallint_check_def_const"` + SmallintCheckDefFunc sql.NullInt64 `db:"smallint_check_def_func"` + SmallintRef sql.NullInt64 `db:"smallint_ref"` + SmallintRefDefConst sql.NullInt64 `db:"smallint_ref_def_const"` + SmallintRefDefFunc sql.NullInt64 `db:"smallint_ref_def_func"` + SmallintRefUniqueCheck sql.NullInt64 `db:"smallint_ref_unique_check"` + SmallintDefConst sql.NullInt64 `db:"smallint_def_const"` + SmallintDefConstUniqueCheck sql.NullInt64 `db:"smallint_def_const_unique_check"` + SmallintDefFunc sql.NullInt64 `db:"smallint_def_func"` + SmallintDefFuncUniqueCheck sql.NullInt64 `db:"smallint_def_func_unique_check"` +} diff --git a/test/postgres10/expected/SmallintCheckPk.go b/test/postgres10/expected/SmallintCheckPk.go new file mode 100644 index 00000000..b751015a --- /dev/null +++ b/test/postgres10/expected/SmallintCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintCheckPk struct { + SmallintCheckPk int `db:"smallint_check_pk"` +} diff --git a/test/postgres10/expected/SmallintDefConstUniqueCheckPk.go b/test/postgres10/expected/SmallintDefConstUniqueCheckPk.go new file mode 100644 index 00000000..e2e17b6f --- /dev/null +++ b/test/postgres10/expected/SmallintDefConstUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPk struct { + SmallintDefConstUniqueCheckPk int `db:"smallint_def_const_unique_check_pk"` +} diff --git a/test/postgres10/expected/SmallintDefConstUniqueCheckPkRef.go b/test/postgres10/expected/SmallintDefConstUniqueCheckPkRef.go new file mode 100644 index 00000000..827d36f7 --- /dev/null +++ b/test/postgres10/expected/SmallintDefConstUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefConstUniqueCheckPkRef struct { + SmallintDefConstUniqueCheckPkRef int `db:"smallint_def_const_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/SmallintDefFuncUniqueCheckPk.go b/test/postgres10/expected/SmallintDefFuncUniqueCheckPk.go new file mode 100644 index 00000000..ab2612af --- /dev/null +++ b/test/postgres10/expected/SmallintDefFuncUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPk struct { + SmallintDefFuncUniqueCheckPk int `db:"smallint_def_func_unique_check_pk"` +} diff --git a/test/postgres10/expected/SmallintDefFuncUniqueCheckPkRef.go b/test/postgres10/expected/SmallintDefFuncUniqueCheckPkRef.go new file mode 100644 index 00000000..3aef8dba --- /dev/null +++ b/test/postgres10/expected/SmallintDefFuncUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintDefFuncUniqueCheckPkRef struct { + SmallintDefFuncUniqueCheckPkRef int `db:"smallint_def_func_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/SmallintNnPk.go b/test/postgres10/expected/SmallintNnPk.go new file mode 100644 index 00000000..e860d504 --- /dev/null +++ b/test/postgres10/expected/SmallintNnPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnPk struct { + SmallintNnPk int `db:"smallint_nn_pk"` +} diff --git a/test/postgres10/expected/SmallintNnUniqueCheckPk.go b/test/postgres10/expected/SmallintNnUniqueCheckPk.go new file mode 100644 index 00000000..09158e0c --- /dev/null +++ b/test/postgres10/expected/SmallintNnUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPk struct { + SmallintNnUniqueCheckPk int `db:"smallint_nn_unique_check_pk"` +} diff --git a/test/postgres10/expected/SmallintNnUniqueCheckPkRef.go b/test/postgres10/expected/SmallintNnUniqueCheckPkRef.go new file mode 100644 index 00000000..29099ecd --- /dev/null +++ b/test/postgres10/expected/SmallintNnUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintNnUniqueCheckPkRef struct { + SmallintNnUniqueCheckPkRef int `db:"smallint_nn_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/SmallintPk.go b/test/postgres10/expected/SmallintPk.go new file mode 100644 index 00000000..7e31ea21 --- /dev/null +++ b/test/postgres10/expected/SmallintPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPk struct { + SmallintPk int `db:"smallint_pk"` +} diff --git a/test/postgres10/expected/SmallintPkDefConst.go b/test/postgres10/expected/SmallintPkDefConst.go new file mode 100644 index 00000000..6674cb63 --- /dev/null +++ b/test/postgres10/expected/SmallintPkDefConst.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefConst struct { + SmallintPkDefConst int `db:"smallint_pk_def_const"` +} diff --git a/test/postgres10/expected/SmallintPkDefFunc.go b/test/postgres10/expected/SmallintPkDefFunc.go new file mode 100644 index 00000000..3951e6bf --- /dev/null +++ b/test/postgres10/expected/SmallintPkDefFunc.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkDefFunc struct { + SmallintPkDefFunc int `db:"smallint_pk_def_func"` +} diff --git a/test/postgres10/expected/SmallintPkRef.go b/test/postgres10/expected/SmallintPkRef.go new file mode 100644 index 00000000..fc0176ef --- /dev/null +++ b/test/postgres10/expected/SmallintPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintPkRef struct { + SmallintPkRef int `db:"smallint_pk_ref"` +} diff --git a/test/postgres10/expected/SmallintRef.go b/test/postgres10/expected/SmallintRef.go new file mode 100644 index 00000000..c2924ae4 --- /dev/null +++ b/test/postgres10/expected/SmallintRef.go @@ -0,0 +1,9 @@ +package dto + +import ( + "database/sql" +) + +type SmallintRef struct { + SmallintRef sql.NullInt64 `db:"smallint_ref"` +} diff --git a/test/postgres10/expected/SmallintUniqueCheckPk.go b/test/postgres10/expected/SmallintUniqueCheckPk.go new file mode 100644 index 00000000..3cf7cccc --- /dev/null +++ b/test/postgres10/expected/SmallintUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPk struct { + SmallintUniqueCheckPk int `db:"smallint_unique_check_pk"` +} diff --git a/test/postgres10/expected/SmallintUniqueCheckPkRef.go b/test/postgres10/expected/SmallintUniqueCheckPkRef.go new file mode 100644 index 00000000..2dc8bfd8 --- /dev/null +++ b/test/postgres10/expected/SmallintUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniqueCheckPkRef struct { + SmallintUniqueCheckPkRef int `db:"smallint_unique_check_pk_ref"` +} diff --git a/test/postgres10/expected/SmallintUniquePk.go b/test/postgres10/expected/SmallintUniquePk.go new file mode 100644 index 00000000..1814500f --- /dev/null +++ b/test/postgres10/expected/SmallintUniquePk.go @@ -0,0 +1,5 @@ +package dto + +type SmallintUniquePk struct { + SmallintUniquePk int `db:"smallint_unique_pk"` +} diff --git a/test/postgres10/expected/Smallserial.go b/test/postgres10/expected/Smallserial.go new file mode 100644 index 00000000..e149ab37 --- /dev/null +++ b/test/postgres10/expected/Smallserial.go @@ -0,0 +1,5 @@ +package dto + +type Smallserial struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialCheck.go b/test/postgres10/expected/SmallserialCheck.go new file mode 100644 index 00000000..996c751c --- /dev/null +++ b/test/postgres10/expected/SmallserialCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialNotnull.go b/test/postgres10/expected/SmallserialNotnull.go new file mode 100644 index 00000000..d3b27168 --- /dev/null +++ b/test/postgres10/expected/SmallserialNotnull.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialNotnull struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialPk.go b/test/postgres10/expected/SmallserialPk.go new file mode 100644 index 00000000..44adb058 --- /dev/null +++ b/test/postgres10/expected/SmallserialPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialRef.go b/test/postgres10/expected/SmallserialRef.go new file mode 100644 index 00000000..0b87f668 --- /dev/null +++ b/test/postgres10/expected/SmallserialRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialRef struct { + SmallserialRef int `db:"smallserial_ref"` +} diff --git a/test/postgres10/expected/SmallserialReferences.go b/test/postgres10/expected/SmallserialReferences.go new file mode 100644 index 00000000..632d8427 --- /dev/null +++ b/test/postgres10/expected/SmallserialReferences.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialReferences struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialUnique.go b/test/postgres10/expected/SmallserialUnique.go new file mode 100644 index 00000000..1848f100 --- /dev/null +++ b/test/postgres10/expected/SmallserialUnique.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUnique struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialUniqueCheck.go b/test/postgres10/expected/SmallserialUniqueCheck.go new file mode 100644 index 00000000..d8ba7e2e --- /dev/null +++ b/test/postgres10/expected/SmallserialUniqueCheck.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheck struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialUniqueCheckPk.go b/test/postgres10/expected/SmallserialUniqueCheckPk.go new file mode 100644 index 00000000..08928c7c --- /dev/null +++ b/test/postgres10/expected/SmallserialUniqueCheckPk.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPk struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialUniqueCheckPkRef.go b/test/postgres10/expected/SmallserialUniqueCheckPkRef.go new file mode 100644 index 00000000..1fee4e9a --- /dev/null +++ b/test/postgres10/expected/SmallserialUniqueCheckPkRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckPkRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/expected/SmallserialUniqueCheckRef.go b/test/postgres10/expected/SmallserialUniqueCheckRef.go new file mode 100644 index 00000000..0e8da3ee --- /dev/null +++ b/test/postgres10/expected/SmallserialUniqueCheckRef.go @@ -0,0 +1,5 @@ +package dto + +type SmallserialUniqueCheckRef struct { + Smallserial int `db:"smallserial"` +} diff --git a/test/postgres10/testdata/bigint.sql b/test/postgres10/testdata/bigint.sql new file mode 100644 index 00000000..f79e8677 --- /dev/null +++ b/test/postgres10/testdata/bigint.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS bigint_ref CASCADE; +CREATE TABLE bigint_ref ( + bigint_ref bigint UNIQUE +); + +DROP TABLE IF EXISTS bigint; +CREATE TABLE bigint ( + bigint bigint, + bigint_nn bigint NOT NULL, + bigint_nn_unique bigint NOT NULL UNIQUE, + bigint_nn_check bigint NOT NULL CHECK ( bigint > 0 ), + bigint_nn_ref bigint NOT NULL REFERENCES bigint_ref(bigint_ref), + bigint_nn_def_const bigint NOT NULL DEFAULT 42, + bigint_nn_def_func bigint NOT NULL DEFAULT pi(), + bigint_nn_unique_check bigint NOT NULL UNIQUE CHECK ( bigint > 0 ), + + bigint_unique bigint UNIQUE, + bigint_unique_check bigint UNIQUE CHECK ( bigint > 0 ), + bigint_unique_ref bigint UNIQUE REFERENCES bigint_ref(bigint_ref), + bigint_unique_def_const bigint UNIQUE DEFAULT 42, + bigint_unique_def_func bigint UNIQUE DEFAULT pi(), + + bigint_check bigint CHECK ( bigint > 0 ), + bigint_check_ref bigint CHECK ( bigint > 0 ) REFERENCES bigint_ref(bigint_ref), + bigint_check_def_const bigint CHECK ( bigint > 0 ) DEFAULT 42, + bigint_check_def_func bigint CHECK ( bigint > 0 ) DEFAULT pi(), + + bigint_ref bigint REFERENCES bigint_ref(bigint_ref), + bigint_ref_def_const bigint REFERENCES bigint_ref(bigint_ref) DEFAULT 42, + bigint_ref_def_func bigint REFERENCES bigint_ref(bigint_ref) DEFAULT pi(), + bigint_ref_unique_check bigint UNIQUE CHECK ( bigint > 0 ) REFERENCES bigint_ref(bigint_ref), + + bigint_def_const bigint DEFAULT 42, + bigint_def_const_unique_check bigint UNIQUE CHECK ( bigint > 0 )DEFAULT 42, + + bigint_def_func bigint DEFAULT pi(), + bigint_def_func_unique_check bigint UNIQUE CHECK ( bigint > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_pk; +CREATE TABLE bigint_pk ( + bigint_pk bigint PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_pk_ref; +CREATE TABLE bigint_pk_ref ( + bigint_pk_ref bigint PRIMARY KEY REFERENCES bigint_ref(bigint_ref) +); + +DROP TABLE IF EXISTS bigint_pk_def_const; +CREATE TABLE bigint_pk_def_const ( + bigint_pk_def_const bigint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_pk_def_func; +CREATE TABLE bigint_pk_def_func ( + bigint_pk_def_func bigint PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_nn_pk; +CREATE TABLE bigint_nn_pk ( + bigint_nn_pk bigint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk; +CREATE TABLE bigint_nn_unique_check_pk ( + bigint_nn_unique_check_pk bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS bigint_nn_unique_check_pk_ref; +CREATE TABLE bigint_nn_unique_check_pk_ref ( + bigint_nn_unique_check_pk_ref bigint PRIMARY KEY NOT NULL UNIQUE CHECK ( bigint_nn_unique_check_pk_ref > 0) REFERENCES bigint_ref(bigint_ref) +); + +DROP TABLE IF EXISTS bigint_unique_pk; +CREATE TABLE bigint_unique_pk ( + bigint_unique_pk bigint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS bigint_unique_check_pk; +CREATE TABLE bigint_unique_check_pk ( + bigint_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_unique_check_pk_ref; +CREATE TABLE bigint_unique_check_pk_ref ( + bigint_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_unique_check_pk_ref > 0) REFERENCES bigint_ref(bigint_ref) +); + +DROP TABLE IF EXISTS bigint_check_pk; +CREATE TABLE bigint_check_pk ( + bigint_check_pk bigint PRIMARY KEY CHECK ( bigint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk; +CREATE TABLE bigint_def_const_unique_check_pk ( + bigint_def_const_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS bigint_def_const_unique_check_pk_ref; +CREATE TABLE bigint_def_const_unique_check_pk_ref ( + bigint_def_const_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES bigint_ref(bigint_ref) +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk; +CREATE TABLE bigint_def_func_unique_check_pk ( + bigint_def_func_unique_check_pk bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS bigint_def_func_unique_check_pk_ref; +CREATE TABLE bigint_def_func_unique_check_pk_ref ( + bigint_def_func_unique_check_pk_ref bigint PRIMARY KEY UNIQUE CHECK ( bigint_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES bigint_ref(bigint_ref) +); diff --git a/test/postgres10/testdata/bigserial.sql b/test/postgres10/testdata/bigserial.sql new file mode 100644 index 00000000..4244225e --- /dev/null +++ b/test/postgres10/testdata/bigserial.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS bigserial_ref CASCADE; +CREATE TABLE bigserial_ref ( + bigserial_ref bigserial UNIQUE +); + +DROP TABLE IF EXISTS bigserial; +CREATE TABLE bigserial ( + bigserial bigserial +); + +DROP TABLE IF EXISTS bigserial_notnull; +CREATE TABLE bigserial_notnull ( + bigserial bigserial NOT NULL +); + +DROP TABLE IF EXISTS bigserial_unique; +CREATE TABLE bigserial_unique ( + bigserial bigserial UNIQUE +); + +DROP TABLE IF EXISTS bigserial_check; +CREATE TABLE bigserial_check ( + bigserial bigserial CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_pk; +CREATE TABLE bigserial_pk ( + bigserial bigserial PRIMARY KEY +); + +DROP TABLE IF EXISTS bigserial_references; +CREATE TABLE bigserial_references ( + bigserial bigserial REFERENCES bigserial_ref (bigserial_ref) +); + +DROP TABLE IF EXISTS bigserial_unique_check; +CREATE TABLE bigserial_unique_check ( + bigserial bigserial UNIQUE CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_unique_check_pk; +CREATE TABLE bigserial_unique_check_pk ( + bigserial bigserial PRIMARY KEY UNIQUE CHECK ( bigserial > 0 ) +); + +DROP TABLE IF EXISTS bigserial_unique_check_pk_ref; +CREATE TABLE bigserial_unique_check_pk_ref ( + bigserial bigserial PRIMARY KEY UNIQUE CHECK ( bigserial > 0 ) REFERENCES bigserial_ref (bigserial_ref) +); + +DROP TABLE IF EXISTS bigserial_unique_check_ref; +CREATE TABLE bigserial_unique_check_ref ( + bigserial bigserial UNIQUE CHECK ( bigserial > 0 ) REFERENCES bigserial_ref (bigserial_ref) +); \ No newline at end of file diff --git a/test/postgres10/testdata/int2.sql b/test/postgres10/testdata/int2.sql new file mode 100644 index 00000000..28954efa --- /dev/null +++ b/test/postgres10/testdata/int2.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS int2_ref CASCADE; +CREATE TABLE int2_ref ( + int2_ref int2 UNIQUE +); + +DROP TABLE IF EXISTS int2; +CREATE TABLE int2 ( + int2 int2, + int2_nn int2 NOT NULL, + int2_nn_unique int2 NOT NULL UNIQUE, + int2_nn_check int2 NOT NULL CHECK ( int2 > 0 ), + int2_nn_ref int2 NOT NULL REFERENCES int2_ref(int2_ref), + int2_nn_def_const int2 NOT NULL DEFAULT 42, + int2_nn_def_func int2 NOT NULL DEFAULT pi(), + int2_nn_unique_check int2 NOT NULL UNIQUE CHECK ( int2 > 0 ), + + int2_unique int2 UNIQUE, + int2_unique_check int2 UNIQUE CHECK ( int2 > 0 ), + int2_unique_ref int2 UNIQUE REFERENCES int2_ref(int2_ref), + int2_unique_def_const int2 UNIQUE DEFAULT 42, + int2_unique_def_func int2 UNIQUE DEFAULT pi(), + + int2_check int2 CHECK ( int2 > 0 ), + int2_check_ref int2 CHECK ( int2 > 0 ) REFERENCES int2_ref(int2_ref), + int2_check_def_const int2 CHECK ( int2 > 0 ) DEFAULT 42, + int2_check_def_func int2 CHECK ( int2 > 0 ) DEFAULT pi(), + + int2_ref int2 REFERENCES int2_ref(int2_ref), + int2_ref_def_const int2 REFERENCES int2_ref(int2_ref) DEFAULT 42, + int2_ref_def_func int2 REFERENCES int2_ref(int2_ref) DEFAULT pi(), + int2_ref_unique_check int2 UNIQUE CHECK ( int2 > 0 ) REFERENCES int2_ref(int2_ref), + + int2_def_const int2 DEFAULT 42, + int2_def_const_unique_check int2 UNIQUE CHECK ( int2 > 0 )DEFAULT 42, + + int2_def_func int2 DEFAULT pi(), + int2_def_func_unique_check int2 UNIQUE CHECK ( int2 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_pk; +CREATE TABLE int2_pk ( + int2_pk int2 PRIMARY KEY +); + +DROP TABLE IF EXISTS int2_pk_ref; +CREATE TABLE int2_pk_ref ( + int2_pk_ref int2 PRIMARY KEY REFERENCES int2_ref(int2_ref) +); + +DROP TABLE IF EXISTS int2_pk_def_const; +CREATE TABLE int2_pk_def_const ( + int2_pk_def_const int2 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int2_pk_def_func; +CREATE TABLE int2_pk_def_func ( + int2_pk_def_func int2 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_nn_pk; +CREATE TABLE int2_nn_pk ( + int2_nn_pk int2 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int2_nn_unique_check_pk; +CREATE TABLE int2_nn_unique_check_pk ( + int2_nn_unique_check_pk int2 PRIMARY KEY NOT NULL UNIQUE CHECK ( int2_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int2_nn_unique_check_pk_ref; +CREATE TABLE int2_nn_unique_check_pk_ref ( + int2_nn_unique_check_pk_ref int2 PRIMARY KEY NOT NULL UNIQUE CHECK ( int2_nn_unique_check_pk_ref > 0) REFERENCES int2_ref(int2_ref) +); + +DROP TABLE IF EXISTS int2_unique_pk; +CREATE TABLE int2_unique_pk ( + int2_unique_pk int2 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int2_unique_check_pk; +CREATE TABLE int2_unique_check_pk ( + int2_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int2_unique_check_pk_ref; +CREATE TABLE int2_unique_check_pk_ref ( + int2_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_unique_check_pk_ref > 0) REFERENCES int2_ref(int2_ref) +); + +DROP TABLE IF EXISTS int2_check_pk; +CREATE TABLE int2_check_pk ( + int2_check_pk int2 PRIMARY KEY CHECK ( int2_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int2_def_const_unique_check_pk; +CREATE TABLE int2_def_const_unique_check_pk ( + int2_def_const_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int2_def_const_unique_check_pk_ref; +CREATE TABLE int2_def_const_unique_check_pk_ref ( + int2_def_const_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int2_ref(int2_ref) +); + +DROP TABLE IF EXISTS int2_def_func_unique_check_pk; +CREATE TABLE int2_def_func_unique_check_pk ( + int2_def_func_unique_check_pk int2 PRIMARY KEY UNIQUE CHECK ( int2_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int2_def_func_unique_check_pk_ref; +CREATE TABLE int2_def_func_unique_check_pk_ref ( + int2_def_func_unique_check_pk_ref int2 PRIMARY KEY UNIQUE CHECK ( int2_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int2_ref(int2_ref) +); diff --git a/test/postgres10/testdata/int4.sql b/test/postgres10/testdata/int4.sql new file mode 100644 index 00000000..94ee50c3 --- /dev/null +++ b/test/postgres10/testdata/int4.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS int4_ref CASCADE; +CREATE TABLE int4_ref ( + int4_ref int4 UNIQUE +); + +DROP TABLE IF EXISTS int4; +CREATE TABLE int4 ( + int4 int4, + int4_nn int4 NOT NULL, + int4_nn_unique int4 NOT NULL UNIQUE, + int4_nn_check int4 NOT NULL CHECK ( int4 > 0 ), + int4_nn_ref int4 NOT NULL REFERENCES int4_ref(int4_ref), + int4_nn_def_const int4 NOT NULL DEFAULT 42, + int4_nn_def_func int4 NOT NULL DEFAULT pi(), + int4_nn_unique_check int4 NOT NULL UNIQUE CHECK ( int4 > 0 ), + + int4_unique int4 UNIQUE, + int4_unique_check int4 UNIQUE CHECK ( int4 > 0 ), + int4_unique_ref int4 UNIQUE REFERENCES int4_ref(int4_ref), + int4_unique_def_const int4 UNIQUE DEFAULT 42, + int4_unique_def_func int4 UNIQUE DEFAULT pi(), + + int4_check int4 CHECK ( int4 > 0 ), + int4_check_ref int4 CHECK ( int4 > 0 ) REFERENCES int4_ref(int4_ref), + int4_check_def_const int4 CHECK ( int4 > 0 ) DEFAULT 42, + int4_check_def_func int4 CHECK ( int4 > 0 ) DEFAULT pi(), + + int4_ref int4 REFERENCES int4_ref(int4_ref), + int4_ref_def_const int4 REFERENCES int4_ref(int4_ref) DEFAULT 42, + int4_ref_def_func int4 REFERENCES int4_ref(int4_ref) DEFAULT pi(), + int4_ref_unique_check int4 UNIQUE CHECK ( int4 > 0 ) REFERENCES int4_ref(int4_ref), + + int4_def_const int4 DEFAULT 42, + int4_def_const_unique_check int4 UNIQUE CHECK ( int4 > 0 )DEFAULT 42, + + int4_def_func int4 DEFAULT pi(), + int4_def_func_unique_check int4 UNIQUE CHECK ( int4 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_pk; +CREATE TABLE int4_pk ( + int4_pk int4 PRIMARY KEY +); + +DROP TABLE IF EXISTS int4_pk_ref; +CREATE TABLE int4_pk_ref ( + int4_pk_ref int4 PRIMARY KEY REFERENCES int4_ref(int4_ref) +); + +DROP TABLE IF EXISTS int4_pk_def_const; +CREATE TABLE int4_pk_def_const ( + int4_pk_def_const int4 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int4_pk_def_func; +CREATE TABLE int4_pk_def_func ( + int4_pk_def_func int4 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_nn_pk; +CREATE TABLE int4_nn_pk ( + int4_nn_pk int4 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int4_nn_unique_check_pk; +CREATE TABLE int4_nn_unique_check_pk ( + int4_nn_unique_check_pk int4 PRIMARY KEY NOT NULL UNIQUE CHECK ( int4_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int4_nn_unique_check_pk_ref; +CREATE TABLE int4_nn_unique_check_pk_ref ( + int4_nn_unique_check_pk_ref int4 PRIMARY KEY NOT NULL UNIQUE CHECK ( int4_nn_unique_check_pk_ref > 0) REFERENCES int4_ref(int4_ref) +); + +DROP TABLE IF EXISTS int4_unique_pk; +CREATE TABLE int4_unique_pk ( + int4_unique_pk int4 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int4_unique_check_pk; +CREATE TABLE int4_unique_check_pk ( + int4_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int4_unique_check_pk_ref; +CREATE TABLE int4_unique_check_pk_ref ( + int4_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_unique_check_pk_ref > 0) REFERENCES int4_ref(int4_ref) +); + +DROP TABLE IF EXISTS int4_check_pk; +CREATE TABLE int4_check_pk ( + int4_check_pk int4 PRIMARY KEY CHECK ( int4_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int4_def_const_unique_check_pk; +CREATE TABLE int4_def_const_unique_check_pk ( + int4_def_const_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int4_def_const_unique_check_pk_ref; +CREATE TABLE int4_def_const_unique_check_pk_ref ( + int4_def_const_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int4_ref(int4_ref) +); + +DROP TABLE IF EXISTS int4_def_func_unique_check_pk; +CREATE TABLE int4_def_func_unique_check_pk ( + int4_def_func_unique_check_pk int4 PRIMARY KEY UNIQUE CHECK ( int4_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int4_def_func_unique_check_pk_ref; +CREATE TABLE int4_def_func_unique_check_pk_ref ( + int4_def_func_unique_check_pk_ref int4 PRIMARY KEY UNIQUE CHECK ( int4_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int4_ref(int4_ref) +); diff --git a/test/postgres10/testdata/int8.sql b/test/postgres10/testdata/int8.sql new file mode 100644 index 00000000..8da55f01 --- /dev/null +++ b/test/postgres10/testdata/int8.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS int8_ref CASCADE; +CREATE TABLE int8_ref ( + int8_ref int8 UNIQUE +); + +DROP TABLE IF EXISTS int8; +CREATE TABLE int8 ( + int8 int8, + int8_nn int8 NOT NULL, + int8_nn_unique int8 NOT NULL UNIQUE, + int8_nn_check int8 NOT NULL CHECK ( int8 > 0 ), + int8_nn_ref int8 NOT NULL REFERENCES int8_ref(int8_ref), + int8_nn_def_const int8 NOT NULL DEFAULT 42, + int8_nn_def_func int8 NOT NULL DEFAULT pi(), + int8_nn_unique_check int8 NOT NULL UNIQUE CHECK ( int8 > 0 ), + + int8_unique int8 UNIQUE, + int8_unique_check int8 UNIQUE CHECK ( int8 > 0 ), + int8_unique_ref int8 UNIQUE REFERENCES int8_ref(int8_ref), + int8_unique_def_const int8 UNIQUE DEFAULT 42, + int8_unique_def_func int8 UNIQUE DEFAULT pi(), + + int8_check int8 CHECK ( int8 > 0 ), + int8_check_ref int8 CHECK ( int8 > 0 ) REFERENCES int8_ref(int8_ref), + int8_check_def_const int8 CHECK ( int8 > 0 ) DEFAULT 42, + int8_check_def_func int8 CHECK ( int8 > 0 ) DEFAULT pi(), + + int8_ref int8 REFERENCES int8_ref(int8_ref), + int8_ref_def_const int8 REFERENCES int8_ref(int8_ref) DEFAULT 42, + int8_ref_def_func int8 REFERENCES int8_ref(int8_ref) DEFAULT pi(), + int8_ref_unique_check int8 UNIQUE CHECK ( int8 > 0 ) REFERENCES int8_ref(int8_ref), + + int8_def_const int8 DEFAULT 42, + int8_def_const_unique_check int8 UNIQUE CHECK ( int8 > 0 )DEFAULT 42, + + int8_def_func int8 DEFAULT pi(), + int8_def_func_unique_check int8 UNIQUE CHECK ( int8 > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_pk; +CREATE TABLE int8_pk ( + int8_pk int8 PRIMARY KEY +); + +DROP TABLE IF EXISTS int8_pk_ref; +CREATE TABLE int8_pk_ref ( + int8_pk_ref int8 PRIMARY KEY REFERENCES int8_ref(int8_ref) +); + +DROP TABLE IF EXISTS int8_pk_def_const; +CREATE TABLE int8_pk_def_const ( + int8_pk_def_const int8 PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS int8_pk_def_func; +CREATE TABLE int8_pk_def_func ( + int8_pk_def_func int8 PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_nn_pk; +CREATE TABLE int8_nn_pk ( + int8_nn_pk int8 NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS int8_nn_unique_check_pk; +CREATE TABLE int8_nn_unique_check_pk ( + int8_nn_unique_check_pk int8 PRIMARY KEY NOT NULL UNIQUE CHECK ( int8_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS int8_nn_unique_check_pk_ref; +CREATE TABLE int8_nn_unique_check_pk_ref ( + int8_nn_unique_check_pk_ref int8 PRIMARY KEY NOT NULL UNIQUE CHECK ( int8_nn_unique_check_pk_ref > 0) REFERENCES int8_ref(int8_ref) +); + +DROP TABLE IF EXISTS int8_unique_pk; +CREATE TABLE int8_unique_pk ( + int8_unique_pk int8 PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS int8_unique_check_pk; +CREATE TABLE int8_unique_check_pk ( + int8_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int8_unique_check_pk_ref; +CREATE TABLE int8_unique_check_pk_ref ( + int8_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_unique_check_pk_ref > 0) REFERENCES int8_ref(int8_ref) +); + +DROP TABLE IF EXISTS int8_check_pk; +CREATE TABLE int8_check_pk ( + int8_check_pk int8 PRIMARY KEY CHECK ( int8_check_pk > 0 ) +); + +DROP TABLE IF EXISTS int8_def_const_unique_check_pk; +CREATE TABLE int8_def_const_unique_check_pk ( + int8_def_const_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS int8_def_const_unique_check_pk_ref; +CREATE TABLE int8_def_const_unique_check_pk_ref ( + int8_def_const_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES int8_ref(int8_ref) +); + +DROP TABLE IF EXISTS int8_def_func_unique_check_pk; +CREATE TABLE int8_def_func_unique_check_pk ( + int8_def_func_unique_check_pk int8 PRIMARY KEY UNIQUE CHECK ( int8_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS int8_def_func_unique_check_pk_ref; +CREATE TABLE int8_def_func_unique_check_pk_ref ( + int8_def_func_unique_check_pk_ref int8 PRIMARY KEY UNIQUE CHECK ( int8_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES int8_ref(int8_ref) +); diff --git a/test/postgres10/testdata/integer.sql b/test/postgres10/testdata/integer.sql new file mode 100644 index 00000000..d69191b5 --- /dev/null +++ b/test/postgres10/testdata/integer.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS integer_ref CASCADE; +CREATE TABLE integer_ref ( + integer_ref integer UNIQUE +); + +DROP TABLE IF EXISTS integer; +CREATE TABLE integer ( + integer integer, + integer_nn integer NOT NULL, + integer_nn_unique integer NOT NULL UNIQUE, + integer_nn_check integer NOT NULL CHECK ( integer > 0 ), + integer_nn_ref integer NOT NULL REFERENCES integer_ref(integer_ref), + integer_nn_def_const integer NOT NULL DEFAULT 42, + integer_nn_def_func integer NOT NULL DEFAULT pi(), + integer_nn_unique_check integer NOT NULL UNIQUE CHECK ( integer > 0 ), + + integer_unique integer UNIQUE, + integer_unique_check integer UNIQUE CHECK ( integer > 0 ), + integer_unique_ref integer UNIQUE REFERENCES integer_ref(integer_ref), + integer_unique_def_const integer UNIQUE DEFAULT 42, + integer_unique_def_func integer UNIQUE DEFAULT pi(), + + integer_check integer CHECK ( integer > 0 ), + integer_check_ref integer CHECK ( integer > 0 ) REFERENCES integer_ref(integer_ref), + integer_check_def_const integer CHECK ( integer > 0 ) DEFAULT 42, + integer_check_def_func integer CHECK ( integer > 0 ) DEFAULT pi(), + + integer_ref integer REFERENCES integer_ref(integer_ref), + integer_ref_def_const integer REFERENCES integer_ref(integer_ref) DEFAULT 42, + integer_ref_def_func integer REFERENCES integer_ref(integer_ref) DEFAULT pi(), + integer_ref_unique_check integer UNIQUE CHECK ( integer > 0 ) REFERENCES integer_ref(integer_ref), + + integer_def_const integer DEFAULT 42, + integer_def_const_unique_check integer UNIQUE CHECK ( integer > 0 )DEFAULT 42, + + integer_def_func integer DEFAULT pi(), + integer_def_func_unique_check integer UNIQUE CHECK ( integer > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_pk; +CREATE TABLE integer_pk ( + integer_pk integer PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_pk_ref; +CREATE TABLE integer_pk_ref ( + integer_pk_ref integer PRIMARY KEY REFERENCES integer_ref(integer_ref) +); + +DROP TABLE IF EXISTS integer_pk_def_const; +CREATE TABLE integer_pk_def_const ( + integer_pk_def_const integer PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_pk_def_func; +CREATE TABLE integer_pk_def_func ( + integer_pk_def_func integer PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_nn_pk; +CREATE TABLE integer_nn_pk ( + integer_nn_pk integer NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk; +CREATE TABLE integer_nn_unique_check_pk ( + integer_nn_unique_check_pk integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS integer_nn_unique_check_pk_ref; +CREATE TABLE integer_nn_unique_check_pk_ref ( + integer_nn_unique_check_pk_ref integer PRIMARY KEY NOT NULL UNIQUE CHECK ( integer_nn_unique_check_pk_ref > 0) REFERENCES integer_ref(integer_ref) +); + +DROP TABLE IF EXISTS integer_unique_pk; +CREATE TABLE integer_unique_pk ( + integer_unique_pk integer PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS integer_unique_check_pk; +CREATE TABLE integer_unique_check_pk ( + integer_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_unique_check_pk_ref; +CREATE TABLE integer_unique_check_pk_ref ( + integer_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_unique_check_pk_ref > 0) REFERENCES integer_ref(integer_ref) +); + +DROP TABLE IF EXISTS integer_check_pk; +CREATE TABLE integer_check_pk ( + integer_check_pk integer PRIMARY KEY CHECK ( integer_check_pk > 0 ) +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk; +CREATE TABLE integer_def_const_unique_check_pk ( + integer_def_const_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS integer_def_const_unique_check_pk_ref; +CREATE TABLE integer_def_const_unique_check_pk_ref ( + integer_def_const_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES integer_ref(integer_ref) +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk; +CREATE TABLE integer_def_func_unique_check_pk ( + integer_def_func_unique_check_pk integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS integer_def_func_unique_check_pk_ref; +CREATE TABLE integer_def_func_unique_check_pk_ref ( + integer_def_func_unique_check_pk_ref integer PRIMARY KEY UNIQUE CHECK ( integer_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES integer_ref(integer_ref) +); diff --git a/test/postgres10/testdata/serial.sql b/test/postgres10/testdata/serial.sql new file mode 100644 index 00000000..fe3be4f1 --- /dev/null +++ b/test/postgres10/testdata/serial.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS serial_ref CASCADE; +CREATE TABLE serial_ref ( + serial_ref serial UNIQUE +); + +DROP TABLE IF EXISTS serial; +CREATE TABLE serial ( + serial serial +); + +DROP TABLE IF EXISTS serial_notnull; +CREATE TABLE serial_notnull ( + serial serial NOT NULL +); + +DROP TABLE IF EXISTS serial_unique; +CREATE TABLE serial_unique ( + serial serial UNIQUE +); + +DROP TABLE IF EXISTS serial_check; +CREATE TABLE serial_check ( + serial serial CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_pk; +CREATE TABLE serial_pk ( + serial serial PRIMARY KEY +); + +DROP TABLE IF EXISTS serial_references; +CREATE TABLE serial_references ( + serial serial REFERENCES serial_ref (serial_ref) +); + +DROP TABLE IF EXISTS serial_unique_check; +CREATE TABLE serial_unique_check ( + serial serial UNIQUE CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_unique_check_pk; +CREATE TABLE serial_unique_check_pk ( + serial serial PRIMARY KEY UNIQUE CHECK ( serial > 0 ) +); + +DROP TABLE IF EXISTS serial_unique_check_pk_ref; +CREATE TABLE serial_unique_check_pk_ref ( + serial serial PRIMARY KEY UNIQUE CHECK ( serial > 0 ) REFERENCES serial_ref (serial_ref) +); + +DROP TABLE IF EXISTS serial_unique_check_ref; +CREATE TABLE serial_unique_check_ref ( + serial serial UNIQUE CHECK ( serial > 0 ) REFERENCES serial_ref (serial_ref) +); \ No newline at end of file diff --git a/test/postgres10/testdata/serial2.sql b/test/postgres10/testdata/serial2.sql new file mode 100644 index 00000000..1840b563 --- /dev/null +++ b/test/postgres10/testdata/serial2.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS serial2_ref CASCADE; +CREATE TABLE serial2_ref ( + serial2_ref serial2 UNIQUE +); + +DROP TABLE IF EXISTS serial2; +CREATE TABLE serial2 ( + serial2 serial2 +); + +DROP TABLE IF EXISTS serial2_notnull; +CREATE TABLE serial2_notnull ( + serial2 serial2 NOT NULL +); + +DROP TABLE IF EXISTS serial2_unique; +CREATE TABLE serial2_unique ( + serial2 serial2 UNIQUE +); + +DROP TABLE IF EXISTS serial2_check; +CREATE TABLE serial2_check ( + serial2 serial2 CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_pk; +CREATE TABLE serial2_pk ( + serial2 serial2 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial2_references; +CREATE TABLE serial2_references ( + serial2 serial2 REFERENCES serial2_ref (serial2_ref) +); + +DROP TABLE IF EXISTS serial2_unique_check; +CREATE TABLE serial2_unique_check ( + serial2 serial2 UNIQUE CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_unique_check_pk; +CREATE TABLE serial2_unique_check_pk ( + serial2 serial2 PRIMARY KEY UNIQUE CHECK ( serial2 > 0 ) +); + +DROP TABLE IF EXISTS serial2_unique_check_pk_ref; +CREATE TABLE serial2_unique_check_pk_ref ( + serial2 serial2 PRIMARY KEY UNIQUE CHECK ( serial2 > 0 ) REFERENCES serial2_ref (serial2_ref) +); + +DROP TABLE IF EXISTS serial2_unique_check_ref; +CREATE TABLE serial2_unique_check_ref ( + serial2 serial2 UNIQUE CHECK ( serial2 > 0 ) REFERENCES serial2_ref (serial2_ref) +); \ No newline at end of file diff --git a/test/postgres10/testdata/serial4.sql b/test/postgres10/testdata/serial4.sql new file mode 100644 index 00000000..ef48c438 --- /dev/null +++ b/test/postgres10/testdata/serial4.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS serial4_ref CASCADE; +CREATE TABLE serial4_ref ( + serial4_ref serial4 UNIQUE +); + +DROP TABLE IF EXISTS serial4; +CREATE TABLE serial4 ( + serial4 serial4 +); + +DROP TABLE IF EXISTS serial4_notnull; +CREATE TABLE serial4_notnull ( + serial4 serial4 NOT NULL +); + +DROP TABLE IF EXISTS serial4_unique; +CREATE TABLE serial4_unique ( + serial4 serial4 UNIQUE +); + +DROP TABLE IF EXISTS serial4_check; +CREATE TABLE serial4_check ( + serial4 serial4 CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_pk; +CREATE TABLE serial4_pk ( + serial4 serial4 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial4_references; +CREATE TABLE serial4_references ( + serial4 serial4 REFERENCES serial4_ref (serial4_ref) +); + +DROP TABLE IF EXISTS serial4_unique_check; +CREATE TABLE serial4_unique_check ( + serial4 serial4 UNIQUE CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_unique_check_pk; +CREATE TABLE serial4_unique_check_pk ( + serial4 serial4 PRIMARY KEY UNIQUE CHECK ( serial4 > 0 ) +); + +DROP TABLE IF EXISTS serial4_unique_check_pk_ref; +CREATE TABLE serial4_unique_check_pk_ref ( + serial4 serial4 PRIMARY KEY UNIQUE CHECK ( serial4 > 0 ) REFERENCES serial4_ref (serial4_ref) +); + +DROP TABLE IF EXISTS serial4_unique_check_ref; +CREATE TABLE serial4_unique_check_ref ( + serial4 serial4 UNIQUE CHECK ( serial4 > 0 ) REFERENCES serial4_ref (serial4_ref) +); diff --git a/test/postgres10/testdata/serial8.sql b/test/postgres10/testdata/serial8.sql new file mode 100644 index 00000000..12d9d992 --- /dev/null +++ b/test/postgres10/testdata/serial8.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS serial8_ref CASCADE; +CREATE TABLE serial8_ref ( + serial8_ref serial8 UNIQUE +); + +DROP TABLE IF EXISTS serial8; +CREATE TABLE serial8 ( + serial8 serial8 +); + +DROP TABLE IF EXISTS serial8_notnull; +CREATE TABLE serial8_notnull ( + serial8 serial8 NOT NULL +); + +DROP TABLE IF EXISTS serial8_unique; +CREATE TABLE serial8_unique ( + serial8 serial8 UNIQUE +); + +DROP TABLE IF EXISTS serial8_check; +CREATE TABLE serial8_check ( + serial8 serial8 CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_pk; +CREATE TABLE serial8_pk ( + serial8 serial8 PRIMARY KEY +); + +DROP TABLE IF EXISTS serial8_references; +CREATE TABLE serial8_references ( + serial8 serial8 REFERENCES serial8_ref (serial8_ref) +); + +DROP TABLE IF EXISTS serial8_unique_check; +CREATE TABLE serial8_unique_check ( + serial8 serial8 UNIQUE CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_unique_check_pk; +CREATE TABLE serial8_unique_check_pk ( + serial8 serial8 PRIMARY KEY UNIQUE CHECK ( serial8 > 0 ) +); + +DROP TABLE IF EXISTS serial8_unique_check_pk_ref; +CREATE TABLE serial8_unique_check_pk_ref ( + serial8 serial8 PRIMARY KEY UNIQUE CHECK ( serial8 > 0 ) REFERENCES serial8_ref (serial8_ref) +); + +DROP TABLE IF EXISTS serial8_unique_check_ref; +CREATE TABLE serial8_unique_check_ref ( + serial8 serial8 UNIQUE CHECK ( serial8 > 0 ) REFERENCES serial8_ref (serial8_ref) +); diff --git a/test/postgres10/testdata/smallint.sql b/test/postgres10/testdata/smallint.sql new file mode 100644 index 00000000..d821cd94 --- /dev/null +++ b/test/postgres10/testdata/smallint.sql @@ -0,0 +1,113 @@ +DROP TABLE IF EXISTS smallint_ref CASCADE; +CREATE TABLE smallint_ref ( + smallint_ref smallint UNIQUE +); + +DROP TABLE IF EXISTS smallint; +CREATE TABLE smallint ( + smallint smallint, + smallint_nn smallint NOT NULL, + smallint_nn_unique smallint NOT NULL UNIQUE, + smallint_nn_check smallint NOT NULL CHECK ( smallint > 0 ), + smallint_nn_ref smallint NOT NULL REFERENCES smallint_ref(smallint_ref), + smallint_nn_def_const smallint NOT NULL DEFAULT 42, + smallint_nn_def_func smallint NOT NULL DEFAULT pi(), + smallint_nn_unique_check smallint NOT NULL UNIQUE CHECK ( smallint > 0 ), + + smallint_unique smallint UNIQUE, + smallint_unique_check smallint UNIQUE CHECK ( smallint > 0 ), + smallint_unique_ref smallint UNIQUE REFERENCES smallint_ref(smallint_ref), + smallint_unique_def_const smallint UNIQUE DEFAULT 42, + smallint_unique_def_func smallint UNIQUE DEFAULT pi(), + + smallint_check smallint CHECK ( smallint > 0 ), + smallint_check_ref smallint CHECK ( smallint > 0 ) REFERENCES smallint_ref(smallint_ref), + smallint_check_def_const smallint CHECK ( smallint > 0 ) DEFAULT 42, + smallint_check_def_func smallint CHECK ( smallint > 0 ) DEFAULT pi(), + + smallint_ref smallint REFERENCES smallint_ref(smallint_ref), + smallint_ref_def_const smallint REFERENCES smallint_ref(smallint_ref) DEFAULT 42, + smallint_ref_def_func smallint REFERENCES smallint_ref(smallint_ref) DEFAULT pi(), + smallint_ref_unique_check smallint UNIQUE CHECK ( smallint > 0 ) REFERENCES smallint_ref(smallint_ref), + + smallint_def_const smallint DEFAULT 42, + smallint_def_const_unique_check smallint UNIQUE CHECK ( smallint > 0 )DEFAULT 42, + + smallint_def_func smallint DEFAULT pi(), + smallint_def_func_unique_check smallint UNIQUE CHECK ( smallint > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_pk; +CREATE TABLE smallint_pk ( + smallint_pk smallint PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_pk_ref; +CREATE TABLE smallint_pk_ref ( + smallint_pk_ref smallint PRIMARY KEY REFERENCES smallint_ref(smallint_ref) +); + +DROP TABLE IF EXISTS smallint_pk_def_const; +CREATE TABLE smallint_pk_def_const ( + smallint_pk_def_const smallint PRIMARY KEY DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_pk_def_func; +CREATE TABLE smallint_pk_def_func ( + smallint_pk_def_func smallint PRIMARY KEY DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_nn_pk; +CREATE TABLE smallint_nn_pk ( + smallint_nn_pk smallint NOT NULL PRIMARY KEY +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk; +CREATE TABLE smallint_nn_unique_check_pk ( + smallint_nn_unique_check_pk smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk > 0) +); + +DROP TABLE IF EXISTS smallint_nn_unique_check_pk_ref; +CREATE TABLE smallint_nn_unique_check_pk_ref ( + smallint_nn_unique_check_pk_ref smallint PRIMARY KEY NOT NULL UNIQUE CHECK ( smallint_nn_unique_check_pk_ref > 0) REFERENCES smallint_ref(smallint_ref) +); + +DROP TABLE IF EXISTS smallint_unique_pk; +CREATE TABLE smallint_unique_pk ( + smallint_unique_pk smallint PRIMARY KEY UNIQUE +); + +DROP TABLE IF EXISTS smallint_unique_check_pk; +CREATE TABLE smallint_unique_check_pk ( + smallint_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_unique_check_pk_ref; +CREATE TABLE smallint_unique_check_pk_ref ( + smallint_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_unique_check_pk_ref > 0) REFERENCES smallint_ref(smallint_ref) +); + +DROP TABLE IF EXISTS smallint_check_pk; +CREATE TABLE smallint_check_pk ( + smallint_check_pk smallint PRIMARY KEY CHECK ( smallint_check_pk > 0 ) +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk; +CREATE TABLE smallint_def_const_unique_check_pk ( + smallint_def_const_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk > 0 ) DEFAULT 42 +); + +DROP TABLE IF EXISTS smallint_def_const_unique_check_pk_ref; +CREATE TABLE smallint_def_const_unique_check_pk_ref ( + smallint_def_const_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_const_unique_check_pk_ref > 0 ) DEFAULT 42 REFERENCES smallint_ref(smallint_ref) +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk; +CREATE TABLE smallint_def_func_unique_check_pk ( + smallint_def_func_unique_check_pk smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk > 0 ) DEFAULT pi() +); + +DROP TABLE IF EXISTS smallint_def_func_unique_check_pk_ref; +CREATE TABLE smallint_def_func_unique_check_pk_ref ( + smallint_def_func_unique_check_pk_ref smallint PRIMARY KEY UNIQUE CHECK ( smallint_def_func_unique_check_pk_ref > 0 ) DEFAULT pi() REFERENCES smallint_ref(smallint_ref) +); diff --git a/test/postgres10/testdata/smallserial.sql b/test/postgres10/testdata/smallserial.sql new file mode 100644 index 00000000..7c7d36a1 --- /dev/null +++ b/test/postgres10/testdata/smallserial.sql @@ -0,0 +1,54 @@ +DROP TABLE IF EXISTS smallserial_ref CASCADE; +CREATE TABLE smallserial_ref ( + smallserial_ref smallserial UNIQUE +); + +DROP TABLE IF EXISTS smallserial; +CREATE TABLE smallserial ( + smallserial smallserial +); + +DROP TABLE IF EXISTS smallserial_notnull; +CREATE TABLE smallserial_notnull ( + smallserial smallserial NOT NULL +); + +DROP TABLE IF EXISTS smallserial_unique; +CREATE TABLE smallserial_unique ( + smallserial smallserial UNIQUE +); + +DROP TABLE IF EXISTS smallserial_check; +CREATE TABLE smallserial_check ( + smallserial smallserial CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_pk; +CREATE TABLE smallserial_pk ( + smallserial smallserial PRIMARY KEY +); + +DROP TABLE IF EXISTS smallserial_references; +CREATE TABLE smallserial_references ( + smallserial smallserial REFERENCES smallserial_ref (smallserial_ref) +); + +DROP TABLE IF EXISTS smallserial_unique_check; +CREATE TABLE smallserial_unique_check ( + smallserial smallserial UNIQUE CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_unique_check_pk; +CREATE TABLE smallserial_unique_check_pk ( + smallserial smallserial PRIMARY KEY UNIQUE CHECK ( smallserial > 0 ) +); + +DROP TABLE IF EXISTS smallserial_unique_check_pk_ref; +CREATE TABLE smallserial_unique_check_pk_ref ( + smallserial smallserial PRIMARY KEY UNIQUE CHECK ( smallserial > 0 ) REFERENCES smallserial_ref (smallserial_ref) +); + +DROP TABLE IF EXISTS smallserial_unique_check_ref; +CREATE TABLE smallserial_unique_check_ref ( + smallserial smallserial UNIQUE CHECK ( smallserial > 0 ) REFERENCES smallserial_ref (smallserial_ref) +); \ No newline at end of file