package {{ group_id }}.{{ project_name_snake }}

import io.ktor.server.application.*
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction

object Items : Table() {
    val id = integer("id").autoIncrement()
    val name = varchar("name", 255)
    val description = varchar("description", 1024).nullable()
    override val primaryKey = PrimaryKey(id)
}

fun Application.configureDatabase() {
    Database.connect("jdbc:h2:mem:{{ project_name_snake }};DB_CLOSE_DELAY=-1;", driver = "org.h2.Driver")
    transaction {
        SchemaUtils.create(Items)
    }
}
