diff --git a/contracts/database/schema/grammar.go b/contracts/database/schema/grammar.go index 087c7134..cb4c4ed3 100644 --- a/contracts/database/schema/grammar.go +++ b/contracts/database/schema/grammar.go @@ -31,8 +31,6 @@ type Grammar interface { CompileViews() string // GetAttributeCommands Get the commands for the schema build. GetAttributeCommands() []string - // GetModifiers Get the column modifiers. - GetModifiers() []func(Blueprint, ColumnDefinition) string // TypeBigInteger Create the column definition for a big integer type. TypeBigInteger(column ColumnDefinition) string // TypeInteger Create the column definition for an integer type. diff --git a/database/schema/blueprint.go b/database/schema/blueprint.go index fc2e8d6a..2f9be351 100644 --- a/database/schema/blueprint.go +++ b/database/schema/blueprint.go @@ -1,6 +1,7 @@ package schema import ( + "fmt" "strings" ormcontract "github.com/goravel/framework/contracts/database/orm" @@ -85,7 +86,7 @@ func (r *Blueprint) GetPrefix() string { func (r *Blueprint) GetTableName() string { // TODO Add schema for Postgres - return r.prefix + r.table + return r.table } func (r *Blueprint) HasCommand(command string) bool { @@ -209,11 +210,20 @@ func (r *Blueprint) addImpliedCommands(grammar schema.Grammar) { } func (r *Blueprint) createIndexName(ttype string, columns []string) string { - table := r.GetTableName() - index := strings.ToLower(table + "_" + strings.Join(columns, "_") + "_" + ttype) + var table string + if strings.Contains(r.table, ".") { + lastDotIndex := strings.LastIndex(r.table, ".") + table = r.table[:lastDotIndex+1] + r.prefix + r.table[lastDotIndex+1:] + } else { + table = r.prefix + r.table + } + + index := strings.ToLower(fmt.Sprintf("%s_%s_%s", table, strings.Join(columns, "_"), ttype)) + index = strings.ReplaceAll(index, "-", "_") + index = strings.ReplaceAll(index, ".", "_") - return strings.ReplaceAll(index, ".", "_") + return index } func (r *Blueprint) indexCommand(ttype string, columns []string, config ...schema.IndexConfig) *schema.Command { diff --git a/database/schema/blueprint_test.go b/database/schema/blueprint_test.go index 019e897d..531a195d 100644 --- a/database/schema/blueprint_test.go +++ b/database/schema/blueprint_test.go @@ -24,7 +24,7 @@ type BlueprintTestSuite struct { func TestBlueprintTestSuite(t *testing.T) { suite.Run(t, &BlueprintTestSuite{ grammars: map[database.Driver]schema.Grammar{ - database.DriverPostgres: grammars.NewPostgres(), + database.DriverPostgres: grammars.NewPostgres("goravel_"), }, }) } @@ -139,6 +139,10 @@ func (s *BlueprintTestSuite) TestBuild() { func (s *BlueprintTestSuite) TestCreateIndexName() { name := s.blueprint.createIndexName("index", []string{"id", "name-1", "name.2"}) s.Equal("goravel_users_id_name_1_name_2_index", name) + + s.blueprint.table = "public.users" + name = s.blueprint.createIndexName("index", []string{"id", "name-1", "name.2"}) + s.Equal("public_goravel_users_id_name_1_name_2_index", name) } func (s *BlueprintTestSuite) TestGetAddedColumns() { @@ -153,11 +157,6 @@ func (s *BlueprintTestSuite) TestGetAddedColumns() { s.Equal(addedColumn, s.blueprint.GetAddedColumns()[0]) } -func (s *BlueprintTestSuite) TestGetTableName() { - s.blueprint.SetTable("users") - s.Equal("goravel_users", s.blueprint.GetTableName()) -} - func (s *BlueprintTestSuite) TestHasCommand() { s.False(s.blueprint.HasCommand(constants.CommandCreate)) s.blueprint.Create() diff --git a/database/schema/grammars/postgres.go b/database/schema/grammars/postgres.go index de935975..fa93c614 100644 --- a/database/schema/grammars/postgres.go +++ b/database/schema/grammars/postgres.go @@ -13,12 +13,14 @@ type Postgres struct { attributeCommands []string modifiers []func(schema.Blueprint, schema.ColumnDefinition) string serials []string + wrap *Wrap } -func NewPostgres() *Postgres { +func NewPostgres(tablePrefix string) *Postgres { postgres := &Postgres{ attributeCommands: []string{constants.CommandComment}, serials: []string{"bigInteger", "integer", "mediumInteger", "smallInteger", "tinyInteger"}, + wrap: NewWrap(tablePrefix), } postgres.modifiers = []func(schema.Blueprint, schema.ColumnDefinition) string{ postgres.ModifyDefault, @@ -30,40 +32,40 @@ func NewPostgres() *Postgres { } func (r *Postgres) CompileAdd(blueprint schema.Blueprint, command *schema.Command) string { - return fmt.Sprintf("alter table %s add column %s", blueprint.GetTableName(), getColumn(r, blueprint, command.Column)) + return fmt.Sprintf("alter table %s add column %s", r.wrap.Table(blueprint.GetTableName()), r.getColumn(blueprint, command.Column)) } func (r *Postgres) CompileCreate(blueprint schema.Blueprint) string { - return fmt.Sprintf("create table %s (%s)", blueprint.GetTableName(), strings.Join(getColumns(r, blueprint), ",")) + return fmt.Sprintf("create table %s (%s)", r.wrap.Table(blueprint.GetTableName()), strings.Join(r.getColumns(blueprint), ", ")) } func (r *Postgres) CompileDropAllDomains(domains []string) string { - return fmt.Sprintf("drop domain %s cascade", strings.Join(domains, ", ")) + return fmt.Sprintf("drop domain %s cascade", strings.Join(r.EscapeNames(domains), ", ")) } func (r *Postgres) CompileDropAllTables(tables []string) string { - return fmt.Sprintf("drop table %s cascade", strings.Join(tables, ", ")) + return fmt.Sprintf("drop table %s cascade", strings.Join(r.EscapeNames(tables), ", ")) } func (r *Postgres) CompileDropAllTypes(types []string) string { - return fmt.Sprintf("drop type %s cascade", strings.Join(types, ", ")) + return fmt.Sprintf("drop type %s cascade", strings.Join(r.EscapeNames(types), ", ")) } func (r *Postgres) CompileDropAllViews(views []string) string { - return fmt.Sprintf("drop view %s cascade", strings.Join(views, ", ")) + return fmt.Sprintf("drop view %s cascade", strings.Join(r.EscapeNames(views), ", ")) } func (r *Postgres) CompileDropIfExists(blueprint schema.Blueprint) string { - return fmt.Sprintf("drop table if exists %s", blueprint.GetTableName()) + return fmt.Sprintf("drop table if exists %s", r.wrap.Table(blueprint.GetTableName())) } func (r *Postgres) CompileForeign(blueprint schema.Blueprint, command *schema.Command) string { sql := fmt.Sprintf("alter table %s add constraint %s foreign key (%s) references %s (%s)", - blueprint.GetTableName(), - command.Index, - strings.Join(command.Columns, ", "), - fmt.Sprintf("%s%s", blueprint.GetPrefix(), command.On), - strings.Join(command.References, ", ")) + r.wrap.Table(blueprint.GetTableName()), + r.wrap.Column(command.Index), + r.wrap.Columns(command.Columns), + r.wrap.Table(command.On), + r.wrap.Columns(command.References)) if command.OnDelete != "" { sql += " on delete " + command.OnDelete } @@ -81,10 +83,10 @@ func (r *Postgres) CompileIndex(blueprint schema.Blueprint, command *schema.Comm } return fmt.Sprintf("create index %s on %s%s (%s)", - command.Index, - blueprint.GetTableName(), + r.wrap.Column(command.Index), + r.wrap.Table(blueprint.GetTableName()), algorithm, - strings.Join(command.Columns, ", "), + r.wrap.Columns(command.Columns), ) } @@ -101,15 +103,15 @@ func (r *Postgres) CompileIndexes(schema, table string) string { "left join pg_attribute a on a.attrelid = i.indrelid and a.attnum = indseq.num "+ "where tc.relname = %s and tn.nspname = %s "+ "group by ic.relname, am.amname, i.indisunique, i.indisprimary", - quoteString(table), - quoteString(schema), + r.wrap.Quote(table), + r.wrap.Quote(schema), ) return query } func (r *Postgres) CompilePrimary(blueprint schema.Blueprint, command *schema.Command) string { - return fmt.Sprintf("alter table %s add primary key (%s)", blueprint.GetTableName(), strings.Join(command.Columns, ",")) + return fmt.Sprintf("alter table %s add primary key (%s)", r.wrap.Table(blueprint.GetTableName()), r.wrap.Columns(command.Columns)) } func (r *Postgres) CompileTables() string { @@ -155,10 +157,6 @@ func (r *Postgres) GetAttributeCommands() []string { return r.attributeCommands } -func (r *Postgres) GetModifiers() []func(blueprint schema.Blueprint, column schema.ColumnDefinition) string { - return r.modifiers -} - func (r *Postgres) ModifyDefault(blueprint schema.Blueprint, column schema.ColumnDefinition) string { if column.GetDefault() != nil { return fmt.Sprintf(" default %s", getDefaultValue(column.GetDefault())) @@ -207,3 +205,22 @@ func (r *Postgres) TypeString(column schema.ColumnDefinition) string { return "varchar" } + +func (r *Postgres) getColumns(blueprint schema.Blueprint) []string { + var columns []string + for _, column := range blueprint.GetAddedColumns() { + columns = append(columns, r.getColumn(blueprint, column)) + } + + return columns +} + +func (r *Postgres) getColumn(blueprint schema.Blueprint, column schema.ColumnDefinition) string { + sql := fmt.Sprintf("%s %s", r.wrap.Column(column.GetName()), getType(r, column)) + + for _, modifier := range r.modifiers { + sql += modifier(blueprint, column) + } + + return sql +} diff --git a/database/schema/grammars/postgres_test.go b/database/schema/grammars/postgres_test.go index 485942b9..55f6aa32 100644 --- a/database/schema/grammars/postgres_test.go +++ b/database/schema/grammars/postgres_test.go @@ -19,7 +19,7 @@ func TestPostgresSuite(t *testing.T) { } func (s *PostgresSuite) SetupTest() { - s.grammar = NewPostgres() + s.grammar = NewPostgres("goravel_") } func (s *PostgresSuite) TestCompileAdd() { @@ -38,7 +38,7 @@ func (s *PostgresSuite) TestCompileAdd() { Column: mockColumn, }) - s.Equal("alter table users add column name varchar(1) default 'goravel' not null", sql) + s.Equal(`alter table "goravel_users" add column "name" varchar(1) default 'goravel' not null`, sql) } func (s *PostgresSuite) TestCompileCreate() { @@ -81,15 +81,31 @@ func (s *PostgresSuite) TestCompileCreate() { // postgres.go::ModifyNullable mockColumn2.EXPECT().GetNullable().Return(true).Once() - s.Equal("create table users (id serial primary key not null,name varchar(100) null)", + s.Equal(`create table "goravel_users" ("id" serial primary key not null, "name" varchar(100) null)`, s.grammar.CompileCreate(mockBlueprint)) } +func (s *PostgresSuite) TestCompileDropAllDomains() { + s.Equal(`drop domain "domain", "user"."email" cascade`, s.grammar.CompileDropAllDomains([]string{"domain", "user.email"})) +} + +func (s *PostgresSuite) TestCompileDropAllTables() { + s.Equal(`drop table "domain", "user"."email" cascade`, s.grammar.CompileDropAllTables([]string{"domain", "user.email"})) +} + +func (s *PostgresSuite) TestCompileDropAllTypes() { + s.Equal(`drop type "domain", "user"."email" cascade`, s.grammar.CompileDropAllTypes([]string{"domain", "user.email"})) +} + +func (s *PostgresSuite) TestCompileDropAllViews() { + s.Equal(`drop view "domain", "user"."email" cascade`, s.grammar.CompileDropAllViews([]string{"domain", "user.email"})) +} + func (s *PostgresSuite) TestCompileDropIfExists() { mockBlueprint := mocksschema.NewBlueprint(s.T()) mockBlueprint.EXPECT().GetTableName().Return("users").Once() - s.Equal("drop table if exists users", s.grammar.CompileDropIfExists(mockBlueprint)) + s.Equal(`drop table if exists "goravel_users"`, s.grammar.CompileDropIfExists(mockBlueprint)) } func (s *PostgresSuite) TestCompileForeign() { @@ -97,7 +113,6 @@ func (s *PostgresSuite) TestCompileForeign() { beforeEach := func() { mockBlueprint = mocksschema.NewBlueprint(s.T()) - mockBlueprint.EXPECT().GetPrefix().Return("goravel_").Once() mockBlueprint.EXPECT().GetTableName().Return("users").Once() } @@ -110,23 +125,23 @@ func (s *PostgresSuite) TestCompileForeign() { name: "with on delete and on update", command: &contractsschema.Command{ Index: "fk_users_role_id", - Columns: []string{"role_id"}, + Columns: []string{"role_id", "user_id"}, On: "roles", - References: []string{"id"}, + References: []string{"id", "user_id"}, OnDelete: "cascade", OnUpdate: "restrict", }, - expectSql: "alter table users add constraint fk_users_role_id foreign key (role_id) references goravel_roles (id) on delete cascade on update restrict", + expectSql: `alter table "goravel_users" add constraint "fk_users_role_id" foreign key ("role_id", "user_id") references "goravel_roles" ("id", "user_id") on delete cascade on update restrict`, }, { name: "without on delete and on update", command: &contractsschema.Command{ Index: "fk_users_role_id", - Columns: []string{"role_id"}, + Columns: []string{"role_id", "user_id"}, On: "roles", - References: []string{"id"}, + References: []string{"id", "user_id"}, }, - expectSql: "alter table users add constraint fk_users_role_id foreign key (role_id) references goravel_roles (id)", + expectSql: `alter table "goravel_users" add constraint "fk_users_role_id" foreign key ("role_id", "user_id") references "goravel_roles" ("id", "user_id")`, }, } @@ -140,6 +155,57 @@ func (s *PostgresSuite) TestCompileForeign() { } } +func (s *PostgresSuite) TestCompileIndex() { + var mockBlueprint *mocksschema.Blueprint + + beforeEach := func() { + mockBlueprint = mocksschema.NewBlueprint(s.T()) + mockBlueprint.EXPECT().GetTableName().Return("users").Once() + } + + tests := []struct { + name string + command *contractsschema.Command + expectSql string + }{ + { + name: "with Algorithm", + command: &contractsschema.Command{ + Index: "fk_users_role_id", + Columns: []string{"role_id", "user_id"}, + Algorithm: "btree", + }, + expectSql: `create index "fk_users_role_id" on "goravel_users" using btree ("role_id", "user_id")`, + }, + { + name: "without Algorithm", + command: &contractsschema.Command{ + Index: "fk_users_role_id", + Columns: []string{"role_id", "user_id"}, + }, + expectSql: `create index "fk_users_role_id" on "goravel_users" ("role_id", "user_id")`, + }, + } + + for _, test := range tests { + s.Run(test.name, func() { + beforeEach() + + sql := s.grammar.CompileIndex(mockBlueprint, test.command) + s.Equal(test.expectSql, sql) + }) + } +} + +func (s *PostgresSuite) TestCompilePrimary() { + mockBlueprint := mocksschema.NewBlueprint(s.T()) + mockBlueprint.EXPECT().GetTableName().Return("users").Once() + + s.Equal(`alter table "goravel_users" add primary key ("role_id", "user_id")`, s.grammar.CompilePrimary(mockBlueprint, &contractsschema.Command{ + Columns: []string{"role_id", "user_id"}, + })) +} + func (s *PostgresSuite) TestEscapeNames() { // SingleName names := []string{"username"} diff --git a/database/schema/grammars/utils.go b/database/schema/grammars/utils.go index 69d27423..7b6ab8cd 100644 --- a/database/schema/grammars/utils.go +++ b/database/schema/grammars/utils.go @@ -10,29 +10,6 @@ import ( "github.com/goravel/framework/contracts/database/schema" ) -func addModify(modifiers []func(schema.Blueprint, schema.ColumnDefinition) string, sql string, blueprint schema.Blueprint, column schema.ColumnDefinition) string { - for _, modifier := range modifiers { - sql += modifier(blueprint, column) - } - - return sql -} - -func getColumn(grammar schema.Grammar, blueprint schema.Blueprint, column schema.ColumnDefinition) string { - sql := fmt.Sprintf("%s %s", column.GetName(), getType(grammar, column)) - - return addModify(grammar.GetModifiers(), sql, blueprint, column) -} - -func getColumns(grammar schema.Grammar, blueprint schema.Blueprint) []string { - var columns []string - for _, column := range blueprint.GetAddedColumns() { - columns = append(columns, getColumn(grammar, blueprint, column)) - } - - return columns -} - func getDefaultValue(def any) string { switch def.(type) { case bool: @@ -60,19 +37,3 @@ func getType(grammar schema.Grammar, column schema.ColumnDefinition) string { return "" } - -func prefixArray(prefix string, values []string) []string { - for i, value := range values { - values[i] = prefix + " " + value - } - - return values -} - -func quoteString(value string) string { - if value == "" { - return value - } - - return fmt.Sprintf("'%s'", value) -} diff --git a/database/schema/grammars/utils_test.go b/database/schema/grammars/utils_test.go index eb1ac005..46019aed 100644 --- a/database/schema/grammars/utils_test.go +++ b/database/schema/grammars/utils_test.go @@ -5,32 +5,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/goravel/framework/contracts/database/schema" mocksschema "github.com/goravel/framework/mocks/database/schema" ) -func TestGetColumns(t *testing.T) { - mockColumn1 := mocksschema.NewColumnDefinition(t) - mockColumn1.EXPECT().GetName().Return("id").Once() - mockColumn1.EXPECT().GetType().Return("string").Once() - - mockColumn2 := mocksschema.NewColumnDefinition(t) - mockColumn2.EXPECT().GetName().Return("name").Once() - mockColumn2.EXPECT().GetType().Return("string").Once() - - mockBlueprint := mocksschema.NewBlueprint(t) - mockBlueprint.EXPECT().GetAddedColumns().Return([]schema.ColumnDefinition{ - mockColumn1, mockColumn2, - }).Once() - - mockGrammar := mocksschema.NewGrammar(t) - mockGrammar.EXPECT().GetModifiers().Return([]func(schema.Blueprint, schema.ColumnDefinition) string{}).Twice() - mockGrammar.EXPECT().TypeString(mockColumn1).Return("varchar(100)").Once() - mockGrammar.EXPECT().TypeString(mockColumn2).Return("varchar").Once() - - assert.Equal(t, []string{"id varchar(100)", "name varchar"}, getColumns(mockGrammar, mockBlueprint)) -} - func TestGetDefaultValue(t *testing.T) { def := true assert.Equal(t, "'1'", getDefaultValue(def)) @@ -63,8 +40,3 @@ func TestGetType(t *testing.T) { assert.Empty(t, getType(mockGrammar1, mockColumn1)) } - -func TestPrefixArray(t *testing.T) { - values := []string{"a", "b", "c"} - assert.Equal(t, []string{"prefix a", "prefix b", "prefix c"}, prefixArray("prefix", values)) -} diff --git a/database/schema/grammars/wrap.go b/database/schema/grammars/wrap.go new file mode 100644 index 00000000..17844bd9 --- /dev/null +++ b/database/schema/grammars/wrap.go @@ -0,0 +1,89 @@ +package grammars + +import ( + "fmt" + "strings" +) + +type Wrap struct { + tablePrefix string +} + +func NewWrap(tablePrefix string) *Wrap { + return &Wrap{ + tablePrefix: tablePrefix, + } +} + +func (r *Wrap) Column(column string) string { + if strings.Contains(column, " as ") { + return r.aliasedValue(column) + } + + return r.Segments(strings.Split(column, ".")) +} + +func (r *Wrap) Columns(columns []string) string { + for i, column := range columns { + columns[i] = r.Column(column) + } + + return strings.Join(columns, ", ") +} + +func (r *Wrap) Quote(value string) string { + if value == "" { + return value + } + + return fmt.Sprintf("'%s'", value) +} + +func (r *Wrap) Segments(segments []string) string { + for i, segment := range segments { + if i == 0 && len(segments) > 1 { + segments[i] = r.Table(segment) + } else { + segments[i] = r.Value(segment) + } + } + + return strings.Join(segments, ".") +} + +func (r *Wrap) Table(table string) string { + if strings.Contains(table, " as ") { + return r.aliasedTable(table) + } + if strings.Contains(table, ".") { + lastDotIndex := strings.LastIndex(table, ".") + newTable := table[:lastDotIndex] + "." + r.tablePrefix + if lastDotIndex+1 < len(table) { + newTable += table[lastDotIndex+1:] + } + + return r.Value(newTable) + } + + return r.Value(r.tablePrefix + table) +} + +func (r *Wrap) Value(value string) string { + if value != "*" { + return `"` + strings.ReplaceAll(value, `"`, `""`) + `"` + } + + return value +} + +func (r *Wrap) aliasedTable(table string) string { + segments := strings.Split(table, " as ") + + return r.Table(segments[0]) + " as " + r.Value(r.tablePrefix+segments[1]) +} + +func (r *Wrap) aliasedValue(value string) string { + segments := strings.Split(value, " as ") + + return r.Column(segments[0]) + " as " + r.Value(r.tablePrefix+segments[1]) +} diff --git a/database/schema/postgres_schema_test.go b/database/schema/postgres_schema_test.go index 50b5fcd3..70792877 100644 --- a/database/schema/postgres_schema_test.go +++ b/database/schema/postgres_schema_test.go @@ -31,7 +31,7 @@ func (s *PostgresSchemaSuite) SetupTest() { postgresDocker := docker.Postgres() s.testQuery = gorm.NewTestQuery(postgresDocker, true) s.mockOrm = mocksorm.NewOrm(s.T()) - s.postgresSchema = NewPostgresSchema(grammars.NewPostgres(), s.mockOrm, "goravel", "framework") + s.postgresSchema = NewPostgresSchema(grammars.NewPostgres("goravel_"), s.mockOrm, "goravel", "goravel_") } // TODO Implement this after implementing create type diff --git a/database/schema/schema.go b/database/schema/schema.go index 52fccd51..d99e1ece 100644 --- a/database/schema/schema.go +++ b/database/schema/schema.go @@ -43,7 +43,7 @@ func NewSchema(config config.Config, log log.Log, orm contractsorm.Orm, migratio case contractsdatabase.DriverPostgres: schema := config.GetString(fmt.Sprintf("database.connections.%s.search_path", orm.Name()), "public") - postgresGrammar := grammars.NewPostgres() + postgresGrammar := grammars.NewPostgres(prefix) driverSchema = NewPostgresSchema(postgresGrammar, orm, schema, prefix) grammar = postgresGrammar case contractsdatabase.DriverSqlserver: @@ -120,8 +120,7 @@ func (r *Schema) HasIndex(table, index string) bool { } func (r *Schema) HasTable(name string) bool { - blueprint := r.createBlueprint(name) - tableName := blueprint.GetTableName() + tableName := r.prefix + name tables, err := r.GetTables() if err != nil { diff --git a/mocks/database/schema/Grammar.go b/mocks/database/schema/Grammar.go index 85ef66cb..73fd8ddc 100644 --- a/mocks/database/schema/Grammar.go +++ b/mocks/database/schema/Grammar.go @@ -713,53 +713,6 @@ func (_c *Grammar_GetAttributeCommands_Call) RunAndReturn(run func() []string) * return _c } -// GetModifiers provides a mock function with given fields: -func (_m *Grammar) GetModifiers() []func(schema.Blueprint, schema.ColumnDefinition) string { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetModifiers") - } - - var r0 []func(schema.Blueprint, schema.ColumnDefinition) string - if rf, ok := ret.Get(0).(func() []func(schema.Blueprint, schema.ColumnDefinition) string); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]func(schema.Blueprint, schema.ColumnDefinition) string) - } - } - - return r0 -} - -// Grammar_GetModifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetModifiers' -type Grammar_GetModifiers_Call struct { - *mock.Call -} - -// GetModifiers is a helper method to define mock.On call -func (_e *Grammar_Expecter) GetModifiers() *Grammar_GetModifiers_Call { - return &Grammar_GetModifiers_Call{Call: _e.mock.On("GetModifiers")} -} - -func (_c *Grammar_GetModifiers_Call) Run(run func()) *Grammar_GetModifiers_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Grammar_GetModifiers_Call) Return(_a0 []func(schema.Blueprint, schema.ColumnDefinition) string) *Grammar_GetModifiers_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Grammar_GetModifiers_Call) RunAndReturn(run func() []func(schema.Blueprint, schema.ColumnDefinition) string) *Grammar_GetModifiers_Call { - _c.Call.Return(run) - return _c -} - // TypeBigInteger provides a mock function with given fields: column func (_m *Grammar) TypeBigInteger(column schema.ColumnDefinition) string { ret := _m.Called(column)