Exemple de conversion : MySQL DDL → Drizzle mysqlTable
Entrée (MySQL DDL)
CREATE TABLE tags (
id INT AUTO_INCREMENT PRIMARY KEY,
slug VARCHAR(50) UNIQUE NOT NULL
); Sortie (Drizzle mysqlTable)
import { mysqlTable, int, varchar } from "drizzle-orm/mysql-core";
export const tags = mysqlTable("tags", {
id: int("id").autoincrement().primaryKey(),
slug: varchar("slug", { length: 50 }).notNull().unique(),
}); Questions fréquentes (FAQ)
Drizzle utilise-t-il des imports spécifiques pour MySQL ?
Oui, les constructeurs de schémas MySQL s’importent depuis drizzle-orm/mysql-core.