Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

PostgreSQL CREATE TABLE to Kotlin data class

Paste a CREATE TABLE, get a data class. Nothing you paste is stored.

Paste a PostgreSQL CREATE TABLE and get a Kotlin data class: nullable columns become T? = null, NUMERIC maps to BigDecimal so money math stays exact, and timestamps come out as java.time types, the same mapping the JPA entity uses.

Mapped from your real DDL, on the server, discarded after the response.

Try it on your own schema

Example

PostgreSQL in:

CREATE TABLE product (
    id BIGSERIAL PRIMARY KEY,
    sku VARCHAR(40) UNIQUE NOT NULL,
    name VARCHAR(200) NOT NULL,
    price NUMERIC(12, 2) NOT NULL,
    in_stock BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMP NOT NULL DEFAULT now()
);

Generated:

Product.kt

import java.math.BigDecimal
import java.time.LocalDateTime

data class Product(
    val id: Long,
    val sku: String,
    val name: String,
    val price: BigDecimal,
    val inStock: Boolean,
    val createdAt: LocalDateTime,
)

Related