I'm getting this error ```Exception in thread "mai...
# komapper
z
I'm getting this error
Copy code
Exception in thread "main" io.r2dbc.spi.R2dbcBadGrammarException: [42001] [42001] Syntax error in SQL statement "create table if not exists [*]user (id bigint not null, guild_id bigint not null, balance integer not null, exp float not null, constraint pk_user primary key(id))"; expected "identifier"; SQL statement:
create table if not exists user (id bigint not null, guild_id bigint not null, balance integer not null, exp float not null, constraint pk_user primary key(id)) [42001-214]
I'm not sure what im doing wrong though, everything looks correct to me:
Copy code
val dbLocation = "./procyon.db"

    val options = ConnectionFactoryOptions.builder()
        .option(ConnectionFactoryOptions.DRIVER, "h2")
        .option(ConnectionFactoryOptions.PROTOCOL, "file")
        .option(ConnectionFactoryOptions.DATABASE, dbLocation)
        .option(Option.valueOf("DB_CLOSE_DELAY"), "-1")
        .build()

    val db = R2dbcDatabase(options)

    db.withTransaction {
        db.runQuery(QueryDsl.create(Meta.guild, Meta.user))
    }
Copy code
@KomapperEntity
//@KomapperOneToMany(targetEntity = User::class)
data class Guild(
    @KomapperId
    val id: Long
)

@KomapperEntity
//@KomapperOneToMany(targetEntity = Guild::class)
data class User(
    @KomapperId
    val id: Long,
    val balance: Int,
    val exp: Float
)
t
It seems that
user
is a reserved word in your database. Try
@KomapperTable(alwaysQuote = true)
as follows:
Copy code
@KomapperEntity
@KomapperTable(alwaysQuote = true)
data class User(...)