What Are Migrations?
Migrations are the bridge between your visual schema design and your actual database. While PicaDeck lets you design your schema visually, migrations are the executable scripts that create or modify your database tables, columns, indexes, and relationships.
PicaDeck generates migrations automatically based on your current schema state. You do not need to write any SQL or configuration by hand — just design visually and export.
Generating a Migration
To generate a migration from your schema:
- Open your project and navigate to the Migrations tab
- Click the Generate Migration button
- Select the source and target branches to compare
- Review the generated output
- Copy to clipboard or download as a file
Note
SQL Migrations
SQL migrations generate standard DDL (Data Definition Language) statements compatible with your project's database type.
PostgreSQL
PostgreSQL exports include:
CREATE TABLEstatements with all columns, types, and constraintsALTER TABLEfor foreign key relationshipsCREATE TYPEfor custom enum and composite typesCREATE INDEXfor indexed columns- Column defaults, NOT NULL constraints, UNIQUE constraints
MySQL
MySQL exports use MySQL-specific syntax including:
CREATE TABLEwith MySQL-compatible data types (INT, VARCHAR, etc.)- Inline ENUM definitions (MySQL supports ENUM as a column type)
ENGINE=InnoDBfor tables with foreign key support- Foreign key constraints with ON DELETE and ON UPDATE clauses
Prisma Schema Export
The Prisma export generates a complete schema.prisma file compatible with the Prisma ORM. This includes:
- Model definitions — each table becomes a Prisma model with field names, types, and attributes
- Relation annotations — foreign key relationships are expressed using Prisma's
@relationsyntax - Enum definitions — custom enums are exported as Prisma enums
- Field attributes —
@id,@unique,@default,@map,?for optional fields - Datasource and generator blocks — configured for your project's database type
Using the Prisma output
prisma/schema.prisma file, then run npx prisma migrate dev to apply it to your database.MongoDB Scripts
For MongoDB projects, PicaDeck generates JavaScript scripts compatible with the MongoDB shell. These include:
db.createCollection()commands for each table- JSON Schema validation rules based on your column types and constraints
createIndex()commands for indexed fields- Unique index definitions for columns marked as unique
Note
Downloading & Copying
After generating a migration, you have two options:
- Copy to clipboard — click the copy button to copy the entire migration script. Paste it directly into your terminal, migration file, or version control
- Download as file — download the migration as a
.sql,.prisma, or.jsfile that you can add directly to your project