WIP: Add dropTableCols from gitea (dropTableColumns at migrations.go) #1523

Closed
6543 wants to merge 7 commits from DropTableCols_fromGitea into master
2 changed files with 15 additions and 0 deletions
Showing only changes of commit 7fa36ef479 - Show all commits

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
}