Skip to content

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

fix: policy updated at (#15230)

Danny Xub82fc1372c53
diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml
index 0546b94bac..c154985bd1 100644
--- a/.github/workflows/backend-tests.yml
+++ b/.github/workflows/backend-tests.yml
@@ -39,7 +39,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
- version: v1.62.2
+ version: v1.64.5
args: --verbose --timeout 20m --max-same-issues=30 --allow-parallel-runners
- name: Run all tests
run: go test -p=8 -tags=mysql -v ./backend/... | tee test.log; exit ${PIPESTATUS[0]}
diff --git a/.golangci.yaml b/.golangci.yaml
index ef5633cdc0..61fd1e1fce 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -21,7 +21,6 @@ linters:
# golangci-lint run --exclude="Rollback,logger.Sync,pgInstance.Stop"
issues:
- include:
# https://golangci-lint.run/usage/configuration/#command-line-options
exclude:
- Rollback
@@ -30,7 +29,7 @@ issues:
- fmt.Printf
- Enter(.*)_(.*)
- Exit(.*)_(.*)
- skip-dirs:
+ exclude-dirs:
- proto/generated-go
- frontend
diff --git a/backend/store/policy.go b/backend/store/policy.go
index 065c5bdbd2..0a051cda27 100644
--- a/backend/store/policy.go
+++ b/backend/store/policy.go
@@ -532,21 +532,23 @@ func (s *Store) DeletePolicyV2(ctx context.Context, policy *PolicyMessage) error
}
func upsertPolicyV2Impl(ctx context.Context, tx *Tx, create *PolicyMessage) (*PolicyMessage, error) {
- if err := tx.QueryRowContext(ctx, `
- INSERT INTO policy (
- resource_type,
- resource,
- inherit_from_parent,
- type,
- payload,
- enforce
- )
- VALUES ($1, $2, $3, $4, $5, $6)
- ON CONFLICT(resource_type, resource, type) DO UPDATE SET
- inherit_from_parent = EXCLUDED.inherit_from_parent,
- payload = EXCLUDED.payload,
- enforce = EXCLUDED.enforce
- RETURNING updated_at
+ create.UpdatedAt = time.Now()
+ if _, err := tx.ExecContext(ctx, `
+ INSERT INTO policy (
+ resource_type,
+ resource,
+ inherit_from_parent,
+ type,
+ payload,
+ enforce,
+ updated_at
+ )
+ VALUES ($1, $2, $3, $4, $5, $6, $7)
+ ON CONFLICT(resource_type, resource, type) DO UPDATE SET
+ inherit_from_parent = EXCLUDED.inherit_from_parent,
+ payload = EXCLUDED.payload,
+ enforce = EXCLUDED.enforce,
+ updated_at = EXCLUDED.updated_at
`,
create.ResourceType,
create.Resource,
@@ -554,8 +556,7 @@ func upsertPolicyV2Impl(ctx context.Context, tx *Tx, create *PolicyMessage) (*Po
create.Type,
create.Payload,
create.Enforce,
- ).Scan(
- &create.UpdatedAt,
+ create.UpdatedAt,
); err != nil {
return nil, err
}