[BUG] ai-proxy-api-key mapper uses MySQL-only NOW(3), non-portable across dialects
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: Medium
- files: `shenyu-admin/src/main/resources/mappers/ai-proxy-api-key-sqlmap.xml:132,155,156,169,181,188`
- description: `insert`, `insertSelective`, `update`, `updateSelective`, and `updateEnableBatch` hardcode `NOW(3)` (MySQL fractional-second `NOW`). H2/PostgreSQL/OpenGauss/Oracle do not accept `NOW(3)`. Unlike `plugin`/`operation-record-log`, this mapper has no `databaseId` variants. It also bypasses the DO's `dateCreated`/`dateUpdated` fields entirely.
- impact: The ai-proxy-api-key CRUD path is broken on every non-MySQL dialect; the entity timestamp fields are ignored on insert.
- suggested_fix: Bind `#{dateCreated}`/`#{dateUpdated}` from the entity (consistent with every other mapper) and let the service set timestamps, or add `databaseId`-specific variants.
- confidence: High
- related_existing: none. Distinct from #5631 (Oracle rule-sqlmap `;`) and #6161 (Oracle schema).
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with shenyu-admin/src/main/resources/mappers/ai-proxy-api-key-sqlmap.xml at lines 132, 155, 156, 169, 181, and 188, then read the related entity and service timestamp handling. Verify the insert, selective insert, update, selective update, and batch-enable paths use the entity timestamps and work across the affected non-MySQL dialects without hardcoded NOW(3).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql, postgresql
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100