Feat v0.5.5 upgrade testing (#35)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m35s
CI/CD / test-sqlite (push) Successful in 2m52s
CI/CD / build-and-deploy (push) Successful in 30s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #35.
This commit is contained in:
2026-03-30 20:50:53 +00:00
committed by xcaliber
parent 4da25350ac
commit 768f15b3cd
9 changed files with 1446 additions and 14 deletions

View File

@@ -224,9 +224,13 @@ func installBundledPackage(pkgPath, packagesDir string, stores store.Stores, run
// Use direct SQL with NULL granted_by to satisfy FK constraint on users(id).
if len(declaredPerms) > 0 {
now := time.Now().UTC().Format(time.RFC3339)
_, err := database.DB.ExecContext(ctx,
`UPDATE extension_permissions SET granted = 1, granted_by = NULL, granted_at = ? WHERE package_id = ? AND granted = 0`,
now, pkgID)
var grantSQL string
if database.IsPostgres() {
grantSQL = `UPDATE extension_permissions SET granted = true, granted_by = NULL, granted_at = $1 WHERE package_id = $2 AND granted = false`
} else {
grantSQL = `UPDATE extension_permissions SET granted = 1, granted_by = NULL, granted_at = ? WHERE package_id = ? AND granted = 0`
}
_, err := database.DB.ExecContext(ctx, grantSQL, now, pkgID)
if err != nil {
log.Printf("[bundled] Failed to auto-grant permissions for %s: %v", pkgID, err)
}