Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: MySql syntax error after setting mode: "date" in timestamp #4234

Open
1 task done
ElPrudi opened this issue Mar 7, 2025 · 2 comments
Open
1 task done

[BUG]: MySql syntax error after setting mode: "date" in timestamp #4234

ElPrudi opened this issue Mar 7, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@ElPrudi
Copy link

ElPrudi commented Mar 7, 2025

Report hasn't been filed before.

  • 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.40.0

What version of drizzle-kit are you using?

0.30.5

Other packages

No response

Describe the Bug

After setting a mysql timestamp like timestamp('created_at', { mode: "date" }).notNull().defaultNow(), it returns an error when trying to get an object from that table:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', iat = 1741345539' at line 1

    at PromisePool.query (node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/promise/pool.js:36:22)
    at MySql2PreparedQuery.execute (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_4ae2dd7e7485ff5e84f46a03732803c4/node_modules/src/mysql2/session.ts:121:31)
    at MySqlSelectBase.execute (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_4ae2dd7e7485ff5e84f46a03732803c4/node_modules/src/mysql-core/query-builders/select.ts:1056:25)
    at MySqlSelectBase.then (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]_4ae2dd7e7485ff5e84f46a03732803c4/node_modules/src/query-promise.ts:31:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
@ElPrudi ElPrudi added the bug Something isn't working label Mar 7, 2025
@ElPrudi ElPrudi changed the title [BUG]: MySql syntax error after setting when using mode: "date" in timestamp [BUG]: MySql syntax error after setting mode: "date" in timestamp Mar 7, 2025
@ElPrudi
Copy link
Author

ElPrudi commented Mar 7, 2025

I think I've bricked my drizzle stuff, because no matter how much I try to revert it, I still get this error.

@ElPrudi
Copy link
Author

ElPrudi commented Mar 7, 2025

Okay, even drizzle-kit pull generates broken SQL for me as this error still doesn't go away. I have to drop drizzle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant