diff --git a/interface.go b/interface.go index a564db12..0c42f60d 100644 --- a/interface.go +++ b/interface.go @@ -28,6 +28,7 @@ type Interface interface { Delete(interface{}) (int64, error) Distinct(columns ...string) *Session DropIndexes(bean interface{}) error + DropTableCols(bean interface{}, cols ...string) error Exec(sqlOrArgs ...interface{}) (sql.Result, error) Exist(bean ...interface{}) (bool, error) Find(interface{}, ...interface{}) error diff --git a/session_schema_test.go b/session_schema_test.go index f24d1405..141f4d5b 100644 --- a/session_schema_test.go +++ b/session_schema_test.go @@ -345,3 +345,17 @@ func TestSync2_Default(t *testing.T) { assertSync(t, new(TestSync2Default)) assert.NoError(t, testEngine.Sync2(new(TestSync2Default))) } + +func TestDropTableCols(t *testing.T) { + type TestDropTableCols struct { + Id int64 + UserId int64 `xorm:"default(1)"` + ToDrop bool `xorm:"default(true)"` + Name string `xorm:"default('my_name')"` + } + + assert.NoError(t, prepareEngine()) + assert.NoError(t, testEngine.Sync2(new(TestDropTableCols))) + assert.NoError(t, testEngine.DropTableCols(new(TestDropTableCols),"name", "to_drop")) + //ToDo: TEST if cols still exist +} \ No newline at end of file