serverKtor/src/main/kotlin/Users.kt
2025-03-18 19:46:43 +03:00

42 lines
1.3 KiB
Kotlin

package com.example
import kotlinx.serialization.Serializable
import org.jetbrains.exposed.sql.ReferenceOption
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.javatime.timestamp
import java.math.BigDecimal
import java.time.Instant
object Users : Table("users") {
val id = integer("id").autoIncrement()
val name = varchar("name", 255)
val email = varchar("email", 255).uniqueIndex()
val passwordHash = text("password_hash")
val resetToken = text("reset_token").nullable()
val createdAt = timestamp("created_at").default(Instant.now())
override val primaryKey = PrimaryKey(id)
}
object Sneakers : Table("sneakers") {
val id = integer("id").autoIncrement()
val name = varchar("name", 255)
val description = varchar("description", 255)
val cost = decimal("cost", 10, 2)
val discount = integer("discount")
val photo = varchar("photo", 255)
val gender = char("gender")
val bootSize = integer("bootsize")
val categoryId = integer("categoryid")
override val primaryKey = PrimaryKey(id)
}
object Categories : Table("categories") {
val id = integer("id").autoIncrement()
val name = varchar("name", 255)
val description = varchar("description", 255)
override val primaryKey = PrimaryKey(id)
}