New Features
drizzle-kit export
To make drizzle-kit integration with other migration tools, like Atlas much easier, we've prepared a new command called export
. It will translate your drizzle schema in SQL representation(DDL) statements and outputs to the console
// schema.ts
import { pgTable, serial, text } from 'drizzle-orm/pg-core'
export const users = pgTable('users', {
id: serial('id').primaryKey(),
email: text('email').notNull(),
name: text('name')
});
Running
npx drizzle-kit export
will output this string to console
CREATE TABLE "users" (
"id" serial PRIMARY KEY NOT NULL,
"email" text NOT NULL,
"name" text
);
By default, the only option for now is --sql
, so the output format will be SQL DDL statements. In the future, we will support additional output formats to accommodate more migration tools
npx drizzle-kit export --sql