drizzle-kit@0.30.1
drizzle-team/drizzle-ormdrizzle-kit@0.30.1Dec 13, 2024by github-actions[bot]
AI Summary
This release introduces a new `drizzle-kit export` command that converts drizzle schema definitions into SQL DDL statements, outputting them to the console. This feature facilitates integration with external migration tools like Atlas, with SQL as the default and currently only supported output format.
Key Highlights
- New `drizzle-kit export` command for schema-to-SQL conversion
- Outputs SQL DDL statements directly to console
- Designed for integration with migration tools like Atlas
- Supports `--sql` flag for explicit SQL output format
- Future plans to support additional output formats
New Features
- drizzle-kit export command - translates drizzle schema to SQL DDL statements
- Console output of CREATE TABLE and other DDL statements
- SQL output format support via `--sql` flag
Full Release Notes
# 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
```ts
// 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
```bash
npx drizzle-kit export
```
will output this string to console
```bash
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
```bash
npx drizzle-kit export --sql
```