SQL to Laravel Migration Converter

Convert raw SQL CREATE TABLE statements to Laravel migration code.

SQL CREATE TABLE Statement

Laravel Migration Code

Next Steps: Create a migration file using php artisan make:migration create__table and paste this code into the up() method.

Features

  • Convert SQL CREATE TABLE to Laravel Schema builder
  • Automatic type mapping (VARCHAR → string, INT → integer, etc.)
  • Handles PRIMARY KEY, UNIQUE, NOT NULL constraints
  • Supports AUTO_INCREMENT and DEFAULT values
  • Generates clean, readable Laravel migration code

How to Use

  1. Paste your SQL CREATE TABLE statement
  2. Click "Convert to Migration"
  3. Review the generated Laravel Schema code
  4. Create a new migration file using artisan
  5. Copy the generated code into the up() method
  6. Run php artisan migrate