Bot Dev
Bot Dev
DTDrizzle Team
Created by Bot Dev on 4/21/2024 in #help
MariaDB driver and generate migrations
The company im working for insists on using MariaDB but im having issues generating migrations for my mariaDB. For schemas i am using 'drizzle-orm/mysql-core' and i create tables with mysqlTable() and for generating the migrations im using drizzle-kit generate:mysql. In the drizzle.config.ts i set the driver to this driver: 'mysql2' when i now want to run drizzle-kit push:mysql i get this error message
Error: 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 'AUTO_INCREMENT NOT NULL'
Error: 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 'AUTO_INCREMENT NOT NULL'
this is my user.ts schema:
export const users = mysqlTable('users', {
id: serial('id').primaryKey(),
fullName: text('full_name'),
});
export const users = mysqlTable('users', {
id: serial('id').primaryKey(),
fullName: text('full_name'),
});
this is the generated migration:
CREATE TABLE `users` (
`id` serial AUTO_INCREMENT NOT NULL,
`full_name` text,
CONSTRAINT `users_id` PRIMARY KEY(`id`)
);
CREATE TABLE `users` (
`id` serial AUTO_INCREMENT NOT NULL,
`full_name` text,
CONSTRAINT `users_id` PRIMARY KEY(`id`)
);
Am i doing something wrong?? 😆 thx for help in advance ❤️
2 replies
DTDrizzle Team
Created by Bot Dev on 4/21/2024 in #help
Naming Migrations
how do i set a name for a new migration when running drizzle-kit generate:mysql ? i tried setting a flag like --tag=new_migration or --name=new_migration. i wouldn't want to rename them manually afterwards everytime 😄
4 replies