Running into an error when runing `drizzle-kit push:mysql` yet i haven't changed anything

So i seem to be running into this error:
$ pnpm db:push

> [email protected] db:push G:\GitHub\Meally\apps\meally
> drizzle-kit push:mysql --config=drizzle.config.ts

drizzle-kit: v0.19.8
drizzle-orm: v0.27.2

Reading config file 'G:\GitHub\Meally\apps\meally\drizzle.config.ts'
Reading schema files:
G:\GitHub\Meally\apps\meally\src\db\schemas\auth.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\enums.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\groups.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\index.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\recipe.ts

errno: 1067,
sql: 'ALTER TABLE `recipes` MODIFY COLUMN `isPublic` boolean;',
sqlState: '42000',
sqlMessage: `target: meally.-.primary: vttablet: rpc error: code = InvalidArgument desc = Invalid default value for 'createdAt' (errno 1067) (sqlstate 42000) (CallerID: 9d6l772g9pp919ug46mn): Sql: "alter table recipes modify column isPublic boolean", BindVars: {REDACTED}`
}
$ pnpm db:push

> [email protected] db:push G:\GitHub\Meally\apps\meally
> drizzle-kit push:mysql --config=drizzle.config.ts

drizzle-kit: v0.19.8
drizzle-orm: v0.27.2

Reading config file 'G:\GitHub\Meally\apps\meally\drizzle.config.ts'
Reading schema files:
G:\GitHub\Meally\apps\meally\src\db\schemas\auth.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\enums.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\groups.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\index.ts
G:\GitHub\Meally\apps\meally\src\db\schemas\recipe.ts

errno: 1067,
sql: 'ALTER TABLE `recipes` MODIFY COLUMN `isPublic` boolean;',
sqlState: '42000',
sqlMessage: `target: meally.-.primary: vttablet: rpc error: code = InvalidArgument desc = Invalid default value for 'createdAt' (errno 1067) (sqlstate 42000) (CallerID: 9d6l772g9pp919ug46mn): Sql: "alter table recipes modify column isPublic boolean", BindVars: {REDACTED}`
}
This has only just been happening since about the last drizzle update, i have tried changing my schema with no luck. My version of drizzle and drizzle-kit
"drizzle-orm": "^0.27.2",
"drizzle-kit": "^0.19.8",
"drizzle-orm": "^0.27.2",
"drizzle-kit": "^0.19.8",
Please find my schema attached below:
7 Replies
Ahmed
Ahmed16mo ago
Are you using planetscale ?
Jacob
JacobOP16mo ago
yeh i think that is the issue however it was working, do you know i might fix that?
Ahmed
Ahmed16mo ago
If so, you need to hardcode each default value of timestamp fields to use sql from drizzle.
default(sql`CURRENT_TIMESTAMP`)
default(sql`CURRENT_TIMESTAMP`)
defaultNow() is making an invalid default value for planetscale db.
Jacob
JacobOP16mo ago
does onUpdateNow() still work as intended or do i need to change that as well?
Ahmed
Ahmed16mo ago
onUpdateNow() is working as intended
Jacob
JacobOP16mo ago
thank you for your help
thecmdrunner
thecmdrunner16mo ago
doesn't seem to be working on me, I'm running into the same error using Planetscale
Want results from more Discord servers?
Add your server