diff --git a/contracts/database/schema/column.go b/contracts/database/schema/column.go index f57910cd9..d7c23de65 100644 --- a/contracts/database/schema/column.go +++ b/contracts/database/schema/column.go @@ -41,7 +41,7 @@ type Column struct { Autoincrement bool Collation string Comment string - Default any + Default string Name string Nullable bool Type string diff --git a/database/schema/blueprint_test.go b/database/schema/blueprint_test.go index 8b5e90b3a..62c5869e5 100644 --- a/database/schema/blueprint_test.go +++ b/database/schema/blueprint_test.go @@ -145,6 +145,41 @@ func (s *BlueprintTestSuite) TestCreateIndexName() { s.Equal("public_goravel_users_id_name_1_name_2_index", name) } +func (s *BlueprintTestSuite) TestDecimal() { + name := "name" + s.blueprint.Decimal(name) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + name: &name, + ttype: convert.Pointer("decimal"), + }) +} + +func (s *BlueprintTestSuite) TestDouble() { + name := "name" + s.blueprint.Double(name) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + name: &name, + ttype: convert.Pointer("double"), + }) +} + +func (s *BlueprintTestSuite) TestFloat() { + name := "name" + s.blueprint.Float(name) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + name: &name, + precision: convert.Pointer(53), + ttype: convert.Pointer("float"), + }) + + s.blueprint.Float(name, 10) + s.Contains(s.blueprint.GetAddedColumns(), &ColumnDefinition{ + name: &name, + precision: convert.Pointer(10), + ttype: convert.Pointer("float"), + }) +} + func (s *BlueprintTestSuite) TestGetAddedColumns() { name := "name" addedColumn := &ColumnDefinition{ diff --git a/database/schema/grammars/mysql.go b/database/schema/grammars/mysql.go index 44c151bf5..b535a9e77 100644 --- a/database/schema/grammars/mysql.go +++ b/database/schema/grammars/mysql.go @@ -168,8 +168,8 @@ func (r *Mysql) GetAttributeCommands() []string { } func (r *Mysql) ModifyComment(blueprint schema.Blueprint, column schema.ColumnDefinition) string { - if column.GetComment() != "" { - return fmt.Sprintf(" comment '%s'", column.GetComment()) + if comment := column.GetComment(); comment != "" { + return fmt.Sprintf(" comment '%s'", comment) } return "" diff --git a/database/schema/grammars/mysql_test.go b/database/schema/grammars/mysql_test.go index 9cdafcb2f..1bfba17e1 100644 --- a/database/schema/grammars/mysql_test.go +++ b/database/schema/grammars/mysql_test.go @@ -32,12 +32,13 @@ func (s *MysqlSuite) TestCompileAdd() { mockColumn.EXPECT().GetDefault().Return("goravel").Twice() mockColumn.EXPECT().GetNullable().Return(false).Once() mockColumn.EXPECT().GetLength().Return(1).Once() + mockColumn.EXPECT().GetComment().Return("comment").Once() sql := s.grammar.CompileAdd(mockBlueprint, &contractsschema.Command{ Column: mockColumn, }) - s.Equal("alter table `goravel_users` add `name` varchar(1) default 'goravel' not null", sql) + s.Equal("alter table `goravel_users` add `name` varchar(1) comment 'comment' default 'goravel' not null", sql) } func (s *MysqlSuite) TestCompileCreate() { @@ -72,6 +73,7 @@ func (s *MysqlSuite) TestCompileCreate() { mockColumn1.EXPECT().GetType().Return("integer").Once() // postgres.go::ModifyNullable mockColumn1.EXPECT().GetNullable().Return(false).Once() + mockColumn1.EXPECT().GetComment().Return("id").Once() // utils.go::getColumns mockColumn2.EXPECT().GetName().Return("name").Once() @@ -85,8 +87,9 @@ func (s *MysqlSuite) TestCompileCreate() { mockColumn2.EXPECT().GetType().Return("string").Once() // postgres.go::ModifyNullable mockColumn2.EXPECT().GetNullable().Return(true).Once() + mockColumn2.EXPECT().GetComment().Return("name").Once() - s.Equal("create table `goravel_users` (`id` int auto_increment primary key not null, `name` varchar(100) null, primary key using btree(`role_id`, `user_id`))", + s.Equal("create table `goravel_users` (`id` int comment 'id' auto_increment primary key not null, `name` varchar(100) comment 'name' null, primary key using btree(`role_id`, `user_id`))", s.grammar.CompileCreate(mockBlueprint)) s.True(primaryCommand.ShouldBeSkipped) } @@ -219,14 +222,16 @@ func (s *MysqlSuite) TestGetColumns() { mockColumn1.EXPECT().GetDefault().Return(nil).Once() mockColumn1.EXPECT().GetNullable().Return(false).Once() mockColumn1.EXPECT().GetAutoIncrement().Return(true).Once() + mockColumn1.EXPECT().GetComment().Return("id").Once() mockColumn2.EXPECT().GetName().Return("name").Once() mockColumn2.EXPECT().GetType().Return("string").Twice() mockColumn2.EXPECT().GetDefault().Return("goravel").Twice() mockColumn2.EXPECT().GetNullable().Return(true).Once() mockColumn2.EXPECT().GetLength().Return(10).Once() + mockColumn2.EXPECT().GetComment().Return("name").Once() - s.Equal([]string{"`id` int auto_increment primary key not null", "`name` varchar(10) default 'goravel' null"}, s.grammar.getColumns(mockBlueprint)) + s.Equal([]string{"`id` int comment 'id' auto_increment primary key not null", "`name` varchar(10) comment 'name' default 'goravel' null"}, s.grammar.getColumns(mockBlueprint)) } func (s *MysqlSuite) TestModifyDefault() { diff --git a/database/schema/grammars/postgres_test.go b/database/schema/grammars/postgres_test.go index 32d8ef08d..265a8a260 100644 --- a/database/schema/grammars/postgres_test.go +++ b/database/schema/grammars/postgres_test.go @@ -46,13 +46,14 @@ func (s *PostgresSuite) TestCompileComment() { mockColumnDefinition := mocksschema.NewColumnDefinition(s.T()) mockBlueprint.On("GetTableName").Return("users").Once() mockColumnDefinition.On("GetName").Return("id").Once() + mockColumnDefinition.On("IsSetComment").Return(true).Once() mockColumnDefinition.On("GetComment").Return("comment").Once() sql := s.grammar.CompileComment(mockBlueprint, &contractsschema.Command{ Column: mockColumnDefinition, }) - s.Equal("comment on column users.id is 'comment'", sql) + s.Equal(`comment on column "goravel_users"."id" is 'comment'`, sql) } func (s *PostgresSuite) TestCompileCreate() { diff --git a/database/schema/processors/mysql_test.go b/database/schema/processors/mysql_test.go new file mode 100644 index 000000000..74d06adec --- /dev/null +++ b/database/schema/processors/mysql_test.go @@ -0,0 +1,59 @@ +package processors + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/goravel/framework/contracts/database/schema" +) + +func TestMysqlProcessColumns(t *testing.T) { + tests := []struct { + name string + dbColumns []DBColumn + expected []schema.Column + }{ + { + name: "ValidInput", + dbColumns: []DBColumn{ + {Name: "id", Type: "int", TypeName: "INT", Nullable: "NO", Extra: "auto_increment", Collation: "utf8_general_ci", Comment: "primary key", Default: "0"}, + {Name: "name", Type: "varchar", TypeName: "VARCHAR", Nullable: "YES", Extra: "", Collation: "utf8_general_ci", Comment: "user name", Default: ""}, + }, + expected: []schema.Column{ + {Autoincrement: true, Collation: "utf8_general_ci", Comment: "primary key", Default: "0", Name: "id", Nullable: false, Type: "int", TypeName: "INT"}, + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "user name", Default: "", Name: "name", Nullable: true, Type: "varchar", TypeName: "VARCHAR"}, + }, + }, + { + name: "EmptyInput", + dbColumns: []DBColumn{}, + }, + { + name: "NullableColumn", + dbColumns: []DBColumn{ + {Name: "description", Type: "text", TypeName: "TEXT", Nullable: "YES", Extra: "", Collation: "utf8_general_ci", Comment: "description", Default: ""}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "description", Default: "", Name: "description", Nullable: true, Type: "text", TypeName: "TEXT"}, + }, + }, + { + name: "NonNullableColumn", + dbColumns: []DBColumn{ + {Name: "created_at", Type: "timestamp", TypeName: "TIMESTAMP", Nullable: "NO", Extra: "", Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP", Name: "created_at", Nullable: false, Type: "timestamp", TypeName: "TIMESTAMP"}, + }, + }, + } + + mysql := NewMysql() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := mysql.ProcessColumns(tt.dbColumns) + assert.Equal(t, tt.expected, result) + }) + } +} diff --git a/database/schema/processors/postgres.go b/database/schema/processors/postgres.go index db9730241..0aad5c612 100644 --- a/database/schema/processors/postgres.go +++ b/database/schema/processors/postgres.go @@ -1,10 +1,10 @@ package processors import ( - "github.com/goravel/framework/support/str" "github.com/spf13/cast" "github.com/goravel/framework/contracts/database/schema" + "github.com/goravel/framework/support/str" ) type Postgres struct { diff --git a/database/schema/processors/postgres_test.go b/database/schema/processors/postgres_test.go index 9dfb21539..5a38c7305 100644 --- a/database/schema/processors/postgres_test.go +++ b/database/schema/processors/postgres_test.go @@ -8,6 +8,56 @@ import ( "github.com/goravel/framework/contracts/database/schema" ) +func TestPostgresProcessColumns(t *testing.T) { + tests := []struct { + name string + dbColumns []DBColumn + expected []schema.Column + }{ + { + name: "ValidInput", + dbColumns: []DBColumn{ + {Name: "id", Type: "int", TypeName: "INT", Nullable: "NO", Extra: "auto_increment", Collation: "utf8_general_ci", Comment: "primary key", Default: "nextval('id_seq'::regclass)"}, + {Name: "name", Type: "varchar", TypeName: "VARCHAR", Nullable: "true", Extra: "", Collation: "utf8_general_ci", Comment: "user name", Default: ""}, + }, + expected: []schema.Column{ + {Autoincrement: true, Collation: "utf8_general_ci", Comment: "primary key", Default: "nextval('id_seq'::regclass)", Name: "id", Nullable: false, Type: "int", TypeName: "INT"}, + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "user name", Default: "", Name: "name", Nullable: true, Type: "varchar", TypeName: "VARCHAR"}, + }, + }, + { + name: "EmptyInput", + dbColumns: []DBColumn{}, + }, + { + name: "NullableColumn", + dbColumns: []DBColumn{ + {Name: "description", Type: "text", TypeName: "TEXT", Nullable: "true", Extra: "", Collation: "utf8_general_ci", Comment: "description", Default: ""}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "description", Default: "", Name: "description", Nullable: true, Type: "text", TypeName: "TEXT"}, + }, + }, + { + name: "NonNullableColumn", + dbColumns: []DBColumn{ + {Name: "created_at", Type: "timestamp", TypeName: "TIMESTAMP", Nullable: "false", Extra: "", Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP", Name: "created_at", Nullable: false, Type: "timestamp", TypeName: "TIMESTAMP"}, + }, + }, + } + + postgres := NewPostgres() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := postgres.ProcessColumns(tt.dbColumns) + assert.Equal(t, tt.expected, result) + }) + } +} + func TestPostgresProcessTypes(t *testing.T) { // ValidTypes_ReturnsProcessedTypes input := []schema.Type{ diff --git a/database/schema/processors/sqlite_test.go b/database/schema/processors/sqlite_test.go index 1fc35dc34..7b56b8695 100644 --- a/database/schema/processors/sqlite_test.go +++ b/database/schema/processors/sqlite_test.go @@ -8,6 +8,56 @@ import ( "github.com/goravel/framework/contracts/database/schema" ) +func TestProcessColumns(t *testing.T) { + tests := []struct { + name string + dbColumns []DBColumn + expected []schema.Column + }{ + { + name: "ValidInput", + dbColumns: []DBColumn{ + {Name: "id", Type: "integer", Nullable: "false", Primary: true, Default: "1"}, + {Name: "name", Type: "varchar", Nullable: "true", Default: "default_name"}, + }, + expected: []schema.Column{ + {Autoincrement: true, Default: "1", Name: "id", Nullable: false, Type: "integer"}, + {Autoincrement: false, Default: "default_name", Name: "name", Nullable: true, Type: "varchar"}, + }, + }, + { + name: "EmptyInput", + dbColumns: []DBColumn{}, + }, + { + name: "NullableColumn", + dbColumns: []DBColumn{ + {Name: "description", Type: "text", Nullable: "true", Default: "default_description"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Default: "default_description", Name: "description", Nullable: true, Type: "text"}, + }, + }, + { + name: "NonNullableColumn", + dbColumns: []DBColumn{ + {Name: "created_at", Type: "timestamp", Nullable: "false", Default: "CURRENT_TIMESTAMP"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Default: "CURRENT_TIMESTAMP", Name: "created_at", Nullable: false, Type: "timestamp"}, + }, + }, + } + + sqlite := NewSqlite() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := sqlite.ProcessColumns(tt.dbColumns) + assert.Equal(t, tt.expected, result) + }) + } +} + func TestSqliteProcessIndexes(t *testing.T) { // Test with valid indexes input := []DBIndex{ diff --git a/database/schema/processors/sqlserver.go b/database/schema/processors/sqlserver.go index c6d469529..cf90abe65 100644 --- a/database/schema/processors/sqlserver.go +++ b/database/schema/processors/sqlserver.go @@ -2,6 +2,7 @@ package processors import ( "fmt" + "github.com/spf13/cast" "github.com/goravel/framework/contracts/database/schema" diff --git a/database/schema/processors/sqlserver_test.go b/database/schema/processors/sqlserver_test.go new file mode 100644 index 000000000..07356f1f2 --- /dev/null +++ b/database/schema/processors/sqlserver_test.go @@ -0,0 +1,105 @@ +package processors + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/goravel/framework/contracts/database/schema" +) + +func TestGetType(t *testing.T) { + tests := []struct { + name string + dbColumn DBColumn + expected string + }{ + { + name: "BinaryWithMaxLength", + dbColumn: DBColumn{TypeName: "binary", Length: -1}, + expected: "binary(max)", + }, + { + name: "VarbinaryWithSpecificLength", + dbColumn: DBColumn{TypeName: "varbinary", Length: 255}, + expected: "varbinary(255)", + }, + { + name: "CharWithSpecificLength", + dbColumn: DBColumn{TypeName: "char", Length: 10}, + expected: "char(10)", + }, + { + name: "DecimalWithPrecisionAndScale", + dbColumn: DBColumn{TypeName: "decimal", Precision: 10, Places: 2}, + expected: "decimal(10,2)", + }, + { + name: "FloatWithPrecision", + dbColumn: DBColumn{TypeName: "float", Precision: 5}, + expected: "float(5)", + }, + { + name: "DefaultTypeName", + dbColumn: DBColumn{TypeName: "int"}, + expected: "int", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := getType(tt.dbColumn) + assert.Equal(t, tt.expected, result) + }) + } +} + +func TestSqlserverProcessColumns(t *testing.T) { + tests := []struct { + name string + dbColumns []DBColumn + expected []schema.Column + }{ + { + name: "ValidInput", + dbColumns: []DBColumn{ + {Name: "id", TypeName: "int", Nullable: "false", Autoincrement: true, Collation: "utf8_general_ci", Comment: "primary key", Default: "1"}, + {Name: "name", TypeName: "varchar", Nullable: "true", Collation: "utf8_general_ci", Comment: "user name", Default: "default_name", Length: 10}, + }, + expected: []schema.Column{ + {Autoincrement: true, Collation: "utf8_general_ci", Comment: "primary key", Default: "1", Name: "id", Nullable: false, Type: "int", TypeName: "int"}, + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "user name", Default: "default_name", Name: "name", Nullable: true, Type: "varchar(10)", TypeName: "varchar"}, + }, + }, + { + name: "EmptyInput", + dbColumns: []DBColumn{}, + }, + { + name: "NullableColumn", + dbColumns: []DBColumn{ + {Name: "description", TypeName: "text", Nullable: "true", Collation: "utf8_general_ci", Comment: "description", Default: "default_description"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "utf8_general_ci", Comment: "description", Default: "default_description", Name: "description", Nullable: true, Type: "text", TypeName: "text"}, + }, + }, + { + name: "NonNullableColumn", + dbColumns: []DBColumn{ + {Name: "created_at", TypeName: "timestamp", Nullable: "false", Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP"}, + }, + expected: []schema.Column{ + {Autoincrement: false, Collation: "", Comment: "creation time", Default: "CURRENT_TIMESTAMP", Name: "created_at", Nullable: false, Type: "timestamp", TypeName: "timestamp"}, + }, + }, + } + + sqlserver := NewSqlserver() + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := sqlserver.ProcessColumns(tt.dbColumns) + assert.Equal(t, tt.expected, result) + }) + } +} diff --git a/database/schema/schema_test.go b/database/schema/schema_test.go index 410dfc27d..d5e0eefe2 100644 --- a/database/schema/schema_test.go +++ b/database/schema/schema_test.go @@ -1283,7 +1283,7 @@ func (s *SchemaSuite) TestID_Mysql() { }, expectDefault: `nextval('"goravel_ID_id_seq"'::regclass)`, expectType: "bigint", - expectTypeName: "int8", + expectTypeName: "bigint", }, { table: "MediumIncrements", @@ -1293,8 +1293,8 @@ func (s *SchemaSuite) TestID_Mysql() { }) }, expectDefault: `nextval('"goravel_MediumIncrements_id_seq"'::regclass)`, - expectType: "integer", - expectTypeName: "int4", + expectType: "mediumint", + expectTypeName: "mediumint", }, { table: "IntegerIncrements", @@ -1304,8 +1304,8 @@ func (s *SchemaSuite) TestID_Mysql() { }) }, expectDefault: `nextval('"goravel_IntegerIncrements_id_seq"'::regclass)`, - expectType: "integer", - expectTypeName: "int4", + expectType: "int", + expectTypeName: "int", }, { table: "SmallIncrements", @@ -1316,7 +1316,7 @@ func (s *SchemaSuite) TestID_Mysql() { }, expectDefault: `nextval('"goravel_SmallIncrements_id_seq"'::regclass)`, expectType: "smallint", - expectTypeName: "int2", + expectTypeName: "smallint", }, { table: "TinyIncrements", @@ -1326,8 +1326,8 @@ func (s *SchemaSuite) TestID_Mysql() { }) }, expectDefault: `nextval('"goravel_TinyIncrements_id_seq"'::regclass)`, - expectType: "smallint", - expectTypeName: "int2", + expectType: "tinyint", + expectTypeName: "tinyint", }, } @@ -1350,6 +1350,87 @@ func (s *SchemaSuite) TestID_Mysql() { } } +func (s *SchemaSuite) TestID_Sqlserver() { + testQuery := s.driverToTestQuery[database.DriverSqlserver] + schema := GetTestSchema(testQuery, s.driverToTestQuery) + + tests := []struct { + table string + setup func(table string) error + expectType string + expectTypeName string + }{ + { + table: "ID", + setup: func(table string) error { + return schema.Create(table, func(table contractsschema.Blueprint) { + table.ID("id").Comment("This is a id column") + }) + }, + expectType: "bigint", + expectTypeName: "bigint", + }, + { + table: "MediumIncrements", + setup: func(table string) error { + return schema.Create(table, func(table contractsschema.Blueprint) { + table.MediumIncrements("id").Comment("This is a id column") + }) + }, + expectType: "int", + expectTypeName: "int", + }, + { + table: "IntegerIncrements", + setup: func(table string) error { + return schema.Create(table, func(table contractsschema.Blueprint) { + table.IntegerIncrements("id").Comment("This is a id column") + }) + }, + expectType: "int", + expectTypeName: "int", + }, + { + table: "SmallIncrements", + setup: func(table string) error { + return schema.Create(table, func(table contractsschema.Blueprint) { + table.SmallIncrements("id").Comment("This is a id column") + }) + }, + expectType: "smallint", + expectTypeName: "smallint", + }, + { + table: "TinyIncrements", + setup: func(table string) error { + return schema.Create(table, func(table contractsschema.Blueprint) { + table.TinyIncrements("id").Comment("This is a id column") + }) + }, + expectType: "tinyint", + expectTypeName: "tinyint", + }, + } + + for _, test := range tests { + s.Run(test.table, func() { + s.Require().Nil(test.setup(test.table)) + s.Require().True(schema.HasTable(test.table)) + + columns, err := schema.GetColumns(test.table) + s.Require().Nil(err) + s.Equal(1, len(columns)) + s.True(columns[0].Autoincrement) + s.Empty(columns[0].Collation) + s.Empty(columns[0].Comment) + s.Empty(columns[0].Default) + s.False(columns[0].Nullable) + s.Equal(test.expectType, columns[0].Type) + s.Equal(test.expectTypeName, columns[0].TypeName) + }) + } +} + func (s *SchemaSuite) TestIndexMethods() { for driver, testQuery := range s.driverToTestQuery { s.Run(driver.String(), func() { @@ -1404,52 +1485,6 @@ func (s *SchemaSuite) TestTable_GetTables() { s.NoError(err) s.Len(tables, 1) - - // Open this after implementing other methods - //s.Require().True(schema.HasColumn("changes", "name")) - //columns, err := schema.GetColumns("changes") - //s.Require().Nil(err) - //for _, column := range columns { - // if column.Name == "name" { - // s.False(column.Autoincrement) - // s.Empty(column.Collation) - // s.Empty(column.Comment) - // s.Empty(column.Default) - // s.False(column.Nullable) - // s.Equal("character varying(255)", column.Type) - // s.Equal("varchar", column.TypeName) - // } - //} - // - //err = schema.Table("changes", func(table migration.Blueprint) { - // table.Integer("age") - // table.String("name").Comment("This is a name column").Default("goravel").Change() - //}) - //s.Nil(err) - //s.True(schema.HasTable("changes")) - //s.Require().True(schema.HasColumns("changes", []string{"name", "age"})) - //columns, err = schema.GetColumns("changes") - //s.Require().Nil(err) - //for _, column := range columns { - // if column.Name == "name" { - // s.False(column.Autoincrement) - // s.Empty(column.Collation) - // s.Equal("This is a name column", column.Comment) - // s.Equal("'goravel'::character varying", column.Default) - // s.False(column.Nullable) - // s.Equal("character varying(255)", column.Type) - // s.Equal("varchar", column.TypeName) - // } - // if column.Name == "age" { - // s.False(column.Autoincrement) - // s.Empty(column.Collation) - // s.Empty(column.Comment) - // s.Empty(column.Default) - // s.False(column.Nullable) - // s.Equal("integer", column.Type) - // s.Equal("int4", column.TypeName) - // } - //} }) } } @@ -1504,6 +1539,8 @@ func (s *SchemaSuite) createTableAndAssertColumnsForColumnMethods(schema contrac s.Require().Nil(err) s.Require().True(schema.HasTable(table)) + s.True(schema.HasColumn(table, "big_integer")) + s.True(schema.HasColumns(table, []string{"big_integer", "decimal"})) columnListing := schema.GetColumnListing(table)