oracle 11g

This commit is contained in:
2024-05-10 11:28:44 +08:00
parent 184a8722d8
commit 2d3723822b
5 changed files with 141 additions and 93 deletions

View File

@ -3,9 +3,10 @@ package oracle
import (
"database/sql"
"fmt"
"gorm.io/gorm/schema"
"strings"
"gorm.io/gorm/schema"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/migrator"
@ -275,11 +276,10 @@ func (m Migrator) HasIndex(value interface{}, name string) bool {
// https://docs.oracle.com/database/121/SPATL/alter-index-rename.htm
func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error {
panic("TODO")
return m.RunWithValue(value, func(stmt *gorm.Statement) error {
return m.DB.Exec(
"ALTER INDEX ?.? RENAME TO ?", // wat
clause.Table{Name: stmt.Table}, clause.Column{Name: oldName}, clause.Column{Name: newName},
"ALTER INDEX ? RENAME TO ?", // wat
clause.Column{Name: oldName}, clause.Column{Name: newName},
).Error
})
}