matrixorigin / matrixorigin/matrixone
[Bug][Regression]: ORM migrations report duplicate index names on existing MatrixOne tables
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Description
MySQL-compatible ORM migrations used by Gogs and Gitea report duplicate index names when run against an existing MatrixOne schema. The applications perform their metadata checks and then issue `CREATE UNIQUE INDEX` for an index that MatrixOne already has, while the same migration is expected to be idempotent on MySQL.
This reproduces the behavior previously tracked in #18704, but is still present in the current `mo-scenario` integration deployment and should be treated as a regression or an incomplete fix.
## Environment
- MatrixOne cloud endpoint exposed through the MySQL protocol on port 6001
- Applications: Gogs 0.13.4 and Gitea integration images
- Observed: 2026-09-16 (private `mo-scenario` cluster)
## Actual behavior
Application logs repeatedly contain:
```text
Gogs: Error 1061 (42000): duplicate key name 'uqe_user_lower_name'
Gogs: Error 1061 (42000): duplicate key name 'uqe_user_name'
Gitea: Error 1061 (42000): duplicate key name 'uqe_access_token_token_hash'
```
The failure is reported from ORM schema synchronization (`sync tables`/`sync database struct`). The applications retry initialization and remain unready; affected pods enter CrashLoopBackOff or never become ready.
The migration path includes checks of `information_schema.statistics` followed by generated `CREATE UNIQUE INDEX` statements. MatrixOne's metadata/DDL behavior is inconsistent with what the ORM expects: the check does not prevent the duplicate DDL from being sent, and the server rejects it with 1061.
## Minimal reproduction shape
```sql
CREATE DATABASE orm_index_repro;
USE orm_index_repro;
CREATE TABLE users (
id VARCHAR(128) NOT NULL,
username VARCHAR(255),
PRIMARY KEY (id),
UNIQUE KEY uqe_user_name (username)
);
```
Run the equivalent ORM auto-migration twice, including its `information_schema.statistics` index-existence query. The second migration should complete without attempting to recreate an existing unique index; on MatrixOne the application instead receives `duplicate key name`.
## Expected behavior
`information_schema.statistics` should expose the logical index in the MySQL-compatible shape expected by ORM migration tools, so a repeated migration is idempotent. MatrixOne should not cause a compatible ORM to recreate an existing index or should otherwise provide the same successful behavior as MySQL for this migration path.
## Impact
Gogs/Gitea cannot start against a reused MatrixOne database. This blocks deploying these applications without modifying their source or adding MatrixOne-specific migration workarounds.
## Related
- #18704 (previous duplicate-index ORM migration report, marked fixed)
- #25103 (information_schema compatibility gaps)
Contributor guide
Assessment
This issue has not been assessed yet.