Skip to content

Commit 35201f6

Browse files
authored
add support for smallint type on migration (#144)
1 parent 279efa7 commit 35201f6

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

column.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const (
88
ID ColumnType = "ID"
99
// Bool ColumnType.
1010
Bool ColumnType = "BOOL"
11+
// SmallInt ColumnType.
12+
SmallInt ColumnType = "SMALLINT"
1113
// Int ColumnType.
1214
Int ColumnType = "INT"
1315
// BigInt ColumnType.

table.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func (t *Table) Bool(name string, options ...ColumnOption) {
3131
t.Column(name, Bool, options...)
3232
}
3333

34+
// SmallInt defines a column with name and Small type.
35+
func (t *Table) SmallInt(name string, options ...ColumnOption) {
36+
t.Column(name, SmallInt, options...)
37+
}
38+
3439
// Int defines a column with name and Int type.
3540
func (t *Table) Int(name string, options ...ColumnOption) {
3641
t.Column(name, Int, options...)

table_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ func TestTable(t *testing.T) {
2525
}, table.Definitions[len(table.Definitions)-1])
2626
})
2727

28+
t.Run("SmallInt", func(t *testing.T) {
29+
table.SmallInt("smallint")
30+
assert.Equal(t, Column{
31+
Name: "smallint",
32+
Type: SmallInt,
33+
}, table.Definitions[len(table.Definitions)-1])
34+
})
35+
2836
t.Run("Int", func(t *testing.T) {
2937
table.Int("integer")
3038
assert.Equal(t, Column{

0 commit comments

Comments
 (0)