'How to generate CREATE TABLE from Kotlin data class

In Kotlin, I'd like to generate a Postgres CREATE TABLE from my data class. For instance, if we have the following: data class Thing(name: String, quantity: Int, bestBefore: LocalDate) I'd like to get this output: CREATE TABLE thing( name TEXT NOT NULL, ...

While there are lots of SQL -> Kotlin generators, such as SQL Delight and jooq, I cannot find anything working in the opposite direction. TIA!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source