SQL to Sequelize Models Converter

Paste any CREATE TABLE SQL and get Sequelize Model.init() definitions with DataTypes, TypeScript interfaces, and correct timestamps configuration.

Runs 100% in your browser. Your input and files never leave your device.

Why use our online SQL to Sequelize Models Converter?

Sequelize requires both a TypeScript interface and a Model.init() call for each table, with careful DataTypes selection and Optional<> type definitions. Converting a 10-table schema manually means writing both the interface and the init call for each column twice. This tool generates both at once.

How to use SQL to Sequelize Models Converter

  1. 1
    Paste your SQL

    Paste one or more CREATE TABLE statements. Click the Sequelize tab.

  2. 2
    Review the output

    The right panel shows TypeScript interfaces and Model.init() calls for each table.

  3. 3
    Check the type mapping

    Expand the Type Mapping panel to verify every column — SQL type → Sequelize DataTypes constant.

  4. 4
    Copy or download

    Click Copy to grab models.ts, or Download ZIP for the full output.

Frequently Asked Questions

What Sequelize version is the output targeting?

Sequelize 6.x with TypeScript support. The output uses the Model.init() style and includes the attributes interface pattern recommended for TypeScript projects.

Are timestamps (createdAt, updatedAt) handled automatically?

Yes, when the "Detect timestamps" option is on. If the table has a created_at or updated_at column, the Model.init() options include timestamps: true. If it has a deleted_at column, paranoid: true is included for soft deletes.

How are Optional<> types generated for creation?

Columns that are nullable, have a default value, or are auto-increment are included in the Optional<Attributes, ...> type for the CreationAttributes. This matches the recommended Sequelize TypeScript pattern.

How are enums handled in Sequelize?

PostgreSQL CREATE TYPE AS ENUM is converted to DataTypes.ENUM with the values array. In MySQL, ENUM columns are handled directly by DataTypes.ENUM as well.

Does the output include association (hasMany/belongsTo) definitions?

Not in the current version — associations are generated per table based on FKs, but the association setup code (Model.associate) needs to be wired manually. The FK column DataTypes definition is correct and the relationship is clear from the column names.

Also useful: Cron BuilderMermaid Live Editor