language-tools
language-tools copied to clipboard
Renaming enum column fails (to set @map)
Bug description
Pressing F2 in VSCode on an enum column does rename the text, but does not set the appropriate @map(originalName) annotation and thus the rename is lost with the next introspection.
How to reproduce
This model below, try to rename aStav:
model CarrierAudit {
auditID Int @id @default(autoincrement()) @map("idAudit")
carrierID Int @map("ncis")
clientID Int @map("idKlient") @db.UnsignedSmallInt
auditedAt DateTime @map("aDatum") @db.Date
aStav AuditStatus
}
enum AuditStatus {
good @map("OK")
bad @map("Vada")
urgent @map("Urgentní")
@@map("auditnos_aStav")
}
Expected behavior
Rename and set @map(...)
Environment & setup
- OS: Windows
- Database: MySQL
- Node.js version: v16.13.2
Prisma Version
prisma : 3.8.1
@prisma/client : 3.8.1
Current platform : windows
Query Engine (Node-API) : libquery-engine 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine : migration-engine-cli 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine : introspection-core 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary : prisma-fmt 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash : 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f
Studio : 0.452.0
Can reproduce, only on enums like stated in this issue, renaming a field or model works.
Should be about this code https://github.com/prisma/language-tools/blob/214040dd8b7f6cdf47204717d61622330c05d0f7/packages/language-server/src/MessageHandler.ts#L503:L522