What is SQL to Exposed Table Generator?
This tool converts SQL CREATE TABLE statements to Kotlin Exposed ORM table object definitions. It generates proper Exposed column types, reference() mappings for foreign keys, and optionally Entity/DAO classes.
How to Use
- Paste your SQL CREATE TABLE statements
- Select your database dialect
- Configure Entity class and DAO pattern options
- Click "Generate" and copy the Kotlin Exposed code
Why Use This Tool?
Tips & Best Practices
- Exposed Table objects use the DSL approach for type-safe SQL queries
- Use Entity classes when you prefer the ORM pattern with mapped objects
- Foreign key references are converted to reference() for proper table relationships
- SERIAL types are automatically mapped with autoIncrement() modifier
Frequently Asked Questions
What is Exposed?
Exposed is a lightweight SQL library for Kotlin developed by JetBrains. It provides both a typesafe SQL DSL and a lightweight ORM for database access, supporting PostgreSQL, MySQL, SQLite, Oracle, and SQL Server.
How are SQL types mapped to Exposed column types?
SQL types are mapped to Exposed column types. INTEGER maps to integer, BIGINT maps to long, VARCHAR maps to varchar(length), TEXT maps to text, BOOLEAN maps to bool, TIMESTAMP maps to timestamp, DATE maps to date, and UUID maps to uuid.
Does it generate Table objects or Entity classes?
The tool generates Exposed Table object definitions by default, which is the DSL approach. It can also optionally generate Entity class definitions for the ORM approach.
How are foreign keys handled?
Foreign key references in SQL are converted to Exposed reference() column definitions with onDelete and onUpdate cascade rules. References create the proper relationship between table objects.
Is my SQL data sent to a server?
No, all processing happens entirely in your browser. Your SQL schema never leaves your device. The conversion is performed client-side using a regex-based parser.