Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: driver close (#3749)

p0ny81f043ed83dc
diff --git a/server/runner/rollbackrun/runner.go b/server/runner/rollbackrun/runner.go
index 813116022d..fef0238e21 100644
--- a/server/runner/rollbackrun/runner.go
+++ b/server/runner/rollbackrun/runner.go
@@ -134,6 +134,7 @@ func (r *Runner) generateRollbackSQLImpl(ctx context.Context, task *api.Task, pa
if err != nil {
return "", errors.WithMessage(err, "failed to get admin database driver")
}
+ defer driver.Close(ctx)
list, err := driver.FindMigrationHistoryList(ctx, &db.MigrationHistoryFind{ID: &payload.MigrationID})
if err != nil {
return "", errors.WithMessagef(err, "failed to find migration history with ID %d", payload.MigrationID)
diff --git a/store/policy.go b/store/policy.go
index fd0205603e..70c18505a5 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -332,6 +332,10 @@ func (s *Store) getPolicyRaw(ctx context.Context, find *api.PolicyFind) (*policy
return nil, err
}
+ if err := tx.Commit(); err != nil {
+ return nil, FormatError(err)
+ }
+
if len(policyRawList) == 0 {
ret = &policyRaw{
CreatorID: api.SystemBotID,