Feat v0.5.5 upgrade testing (#35)
All checks were successful
All checks were successful
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user