Error in SQL syntax when pushing schema

Hello, I'm trying to push my database schema to planetscale using drizzle-kit push:mysql , but I got the error below after confirming the execution. Can someone point out for me what did i do wrong?

Error: target: admin-dashboard.-.primary: vttablet: rpc error: code = InvalidArgument desc = 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


this is my schema
export const customers = mysqlTable("customer", {
  id: varchar("id", { length: 256 })
    .default(sql`UUID()`)
    .primaryKey(),
  fullName: varchar("full_name", { length: 256 }).notNull(),
  email: varchar("email", { length: 256 }),
  phoneNumber: varchar("phone_number", { length: 256 }).unique().notNull(),
  createdAt: datetime("created_at", { fsp: 3 })
    .notNull()
    .default(sql`CURRENT_TIMESTAMP()`),
  updatedAt: datetime("updated_at", { fsp: 3 })
    .notNull()
    .default(sql`CURRENT_TIMESTAMP()`),
});


and this is the SQL generated by drizzle-kit push:mysql
CREATE TABLE `customer` (
    `id` varchar(256) NOT NULL DEFAULT UUID(),
    `full_name` varchar(256) NOT NULL,
    `email` varchar(256),
    `phone_number` varchar(256) NOT NULL,
    `created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    `updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    CONSTRAINT `customer_id` PRIMARY KEY(`id`),
    CONSTRAINT `customer_phone_number_unique` UNIQUE(`phone_number`)
);


Thank you
Solution
i decided to not generate the uuid from the schema, remove the default value from the ID, and generate the ID when i'm calling the function. Thank you
Was this page helpful?