fix(unified): in-proc SQLite data migration (#114537)

* feat: unified storage migrations integration tests

* chore: add comment and adjust db path name

* chore: refactor test cases into interface

* fix: unified SQLite migration with SQLStore migrator

* revert changes to newResourceDBProvider
This commit is contained in:
Rafael Bortolon Paulovic
2025-11-28 13:13:35 +01:00
committed by GitHub
parent 11a27ab870
commit 12c6d7e83f
7 changed files with 286 additions and 132 deletions
+10 -1
View File
@@ -7,6 +7,7 @@ package xorm
import (
"context"
"database/sql"
"errors"
"fmt"
"hash/crc32"
"reflect"
@@ -43,7 +44,7 @@ type Session struct {
afterProcessors []executedProcessor
prepareStmt bool
stmtCache map[uint32]*core.Stmt //key: hash.Hash32 of (queryStr, len(queryStr))
stmtCache map[uint32]*core.Stmt // key: hash.Hash32 of (queryStr, len(queryStr))
// !evalphobia! stored the last executed query on this session
lastSQL string
@@ -236,6 +237,14 @@ func (session *Session) DB() *core.DB {
return session.db
}
// Tx returns the underlying transaction
func (session *Session) Tx() (*core.Tx, error) {
if session.tx == nil {
return nil, errors.New("no open transaction")
}
return session.tx, nil
}
func cleanupProcessorsClosures(slices *[]func(any)) {
if len(*slices) > 0 {
*slices = make([]func(any), 0)