Closed CoiaPrant233 closed 3 months ago
this is the code I test. I successfully insert 10 rows in the table
package main
import (
"database/sql"
"fmt"
_ "github.com/sijms/go-ora/v2"
go_ora "github.com/sijms/go-ora/v2"
oracle "gitlab.com/CoiaPrant/gorm-oracle"
"gorm.io/gorm"
"os"
"strconv"
)
type Keywords struct {
Id int64 `gorm:"column:id; primaryKey"`
Key string `gorm:"column:key; not null; unique"`
Value string `gorm:"column:value; not null"`
Ignored bool `gorm:"column:ignored; not null; default:false"`
}
func main() {
var err error
db, err := gorm.Open(oracle.Open(os.Getenv("DSN_CLOUD")), &gorm.Config{})
if err != nil {
fmt.Println("can't connect: ", err)
return
}
err = db.AutoMigrate(&Keywords{})
if err != nil {
fmt.Println("can't migrate: ", err)
return
}
for x := 0; x < 10; x++ {
model := &Keywords{
Key: strconv.Itoa(x + 1),
Value: "demo_" + strconv.Itoa(x+1),
Ignored: false,
}
tx := db.Create(model)
tx.Commit()
fmt.Println("ID: ", model.Id)
}
}
it print ID: 0
for all. I think issue in the gitlab.com/CoiaPrant/gorm-oracle
also another issue after dropping the table identity sequence is remain
also fix regression with issue #307
I think the issue is SELECT FOR UPDATE
I am fixing it
fixed in v2.8.10
See https://github.com/sijms/go-ora/issues/493