This commit is contained in:
6543 2020-02-19 14:28:29 +01:00
parent 56bdd86430
commit 7fa36ef479
No known key found for this signature in database
GPG Key ID: A1CA74D27FD13271
2 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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
}