Skip to content

Commit

Permalink
add support for smallint type on migration (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsanulks committed Feb 15, 2021
1 parent 279efa7 commit 35201f6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions column.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const (
ID ColumnType = "ID"
// Bool ColumnType.
Bool ColumnType = "BOOL"
// SmallInt ColumnType.
SmallInt ColumnType = "SMALLINT"
// Int ColumnType.
Int ColumnType = "INT"
// BigInt ColumnType.
Expand Down
5 changes: 5 additions & 0 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func (t *Table) Bool(name string, options ...ColumnOption) {
t.Column(name, Bool, options...)
}

// SmallInt defines a column with name and Small type.
func (t *Table) SmallInt(name string, options ...ColumnOption) {
t.Column(name, SmallInt, options...)
}

// Int defines a column with name and Int type.
func (t *Table) Int(name string, options ...ColumnOption) {
t.Column(name, Int, options...)
Expand Down
8 changes: 8 additions & 0 deletions table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ func TestTable(t *testing.T) {
}, table.Definitions[len(table.Definitions)-1])
})

t.Run("SmallInt", func(t *testing.T) {
table.SmallInt("smallint")
assert.Equal(t, Column{
Name: "smallint",
Type: SmallInt,
}, table.Definitions[len(table.Definitions)-1])
})

t.Run("Int", func(t *testing.T) {
table.Int("integer")
assert.Equal(t, Column{
Expand Down

0 comments on commit 35201f6

Please sign in to comment.