One-click convert SQL CREATE TABLE statements to Sequelize Model definitions, supporting MySQL/PostgreSQL/SQLite
Zero Dependencies · Works Offline📝 SQL Input
📜 History
What is SQL to Sequelize Model Converter?
The SQL to Sequelize Model Converter is a free online developer tool that instantly converts SQL CREATE TABLE statements into Sequelize Model definition code. It automatically identifies SQL data types and maps them to Sequelize types, supports MySQL, PostgreSQL, and SQLite dialects, parses PRIMARY KEY, FOREIGN KEY, DEFAULT, NOT NULL constraints, and generates Sequelize-compliant Model code. Perfect for Node.js developers who need to quickly generate ORM models from existing databases. All conversion happens locally in your browser — no data is ever uploaded to a server.
Core Features
- Smart Type Mapping: Auto-converts SQL types (INT, VARCHAR, TEXT, DATETIME, etc.) to Sequelize types (INTEGER, STRING, TEXT, DATE, etc.)
- Multi-Dialect Support: Supports MySQL, PostgreSQL, and SQLite with automatic dialect-specific type adaptation
- Constraint Parsing: Parses PRIMARY KEY, FOREIGN KEY, NOT NULL, DEFAULT, UNIQUE, AUTO_INCREMENT constraints
- Association Generation: Foreign key constraints automatically generate belongsTo/hasMany association code
- History: Auto-saves last 5 conversions for easy review and reuse
How to Use
1. Paste your SQL CREATE TABLE statement into the input area, or click "Load Example" to try it quickly.
2. Select the SQL dialect and conversion options: auto timestamps, soft delete, freeze table name, etc.
3. Click "Convert" or use Ctrl+Enter to execute.
4. View the generated Sequelize Model code in the result area below.
5. Click "Copy Code" to copy to clipboard, or download as a .js file.
Use Cases
Database Migration
When migrating from traditional SQL projects to Node.js+Sequelize, use this tool to quickly convert existing table structures to Sequelize Models, accelerating project refactoring.
API Development
Backend developers can generate Sequelize Model definitions from SQL CREATE TABLE scripts in database design documents, rapidly building RESTful APIs.
Team Collaboration
DBAs provide SQL scripts; developers convert them to Sequelize code, ensuring Model definitions match database structure.
Learning Sequelize
Beginners can quickly understand ORM type mapping and constraint expressions by comparing SQL and Sequelize code side by side.
Technical Background
Sequelize is one of the most popular Node.js ORM frameworks, supporting PostgreSQL, MySQL, SQLite, and MSSQL. Sequelize Models define database table structure mappings including field types, constraints, indexes, and associations. SQL-to-Sequelize type mapping follows specific rules: INT→INTEGER, VARCHAR(n)→STRING(n), TEXT→TEXT, BOOLEAN→BOOLEAN, DATETIME→DATE, DECIMAL(p,s)→DECIMAL(p,s). The timestamps option adds createdAt and updatedAt fields by default, paranoid adds deletedAt for soft deletes, and freezeTableName prevents Sequelize from pluralizing model names as table names.
âť“ FAQ
Which SQL dialects are supported?
MySQL, PostgreSQL, and SQLite CREATE TABLE syntax are supported with automatic type mapping.
Can it handle foreign keys?
Yes. FOREIGN KEY constraints are parsed and generate Sequelize belongsTo/hasMany association code.
Does it support default values?
Yes. DEFAULT values are converted to Sequelize defaultValue properties, including function defaults like NOW().
Is my data uploaded?
No. Everything runs locally: SQL to Sequelize Model and other values are processed on your device, never sent to a server. Your data never leaves your device.
Can generated code be used directly?
Yes. The output follows Sequelize conventions and can be used in CLI migration or model files.
Can I import SQL from a file?
Yes. Drag and drop a SQL file onto the input area, or click Load Example.