drizzle-team / drizzle-team/drizzle-orm
[BUG]: Renaming column fails in mariadb
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.44.6
### What version of `drizzle-kit` are you using?
0.31.5
### Other packages
_No response_
### Describe the Bug
When changing a column name for a MySQL table created with Drizzle, and using the SQL generated by `drizzle-kit generate`, the update is always failing with a non-specific error message.
Example table
```typescript
const Status = mysqlTable("Status", {
ID: tinyint({unsigned: true}).autoincrement().primaryKey(),
Name: varchar({length: 30}).notNull()
});
```
If I then change the name of `Name` to `Description`, and rerun `drizzle-kit generate`, then the following SQL is generated.
```SQL
ALTER TABLE `Status` RENAME COLUMN `Name` TO `Description`;--> statement-breakpoint
```
This always fails with the following message
```
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLUMN `Name` TO `Description`' at line 1
```
## Database Details
Here is the result of running `status` on the database.
```
--------------
mysql Ver 15.1 Distrib 10.4.32-MariaDB, for Win64 (AMD64), source revision c4143f909528e3fab0677a28631d10389354c491
Connection id: 13
Current database: nqtv2
Current user: nqtv2@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 10.4.32-MariaDB mariadb.org binary distribution
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: cp850
Conn. characterset: cp850
TCP port: 3306
Uptime: 43 min 13 sec
Threads: 9 Questions: 50 Slow queries: 0 Opens: 49 Flush tables: 1 Open tables: 36 Queries per second avg: 0.019
--------------
Contributor guide
Assessment
This issue has not been assessed yet.