官术网_书友最值得收藏!

  • Kotlin Blueprints
  • Ashish Belagali Hardik Trivedi Akshay Chordiya
  • 106字
  • 2021-07-02 21:50:14

Defining the table

To define a table you need to create an object with the required fields and extend the Table class and Exposed will create the table in the database for you with the fields as columns:

    object Messages: Table() {
      val id = integer("id").autoIncrement().primaryKey()
      val name = varchar("name", 100)
    }

It will result in the following query called by Exposed:

    CREATE TABLE IF NOT EXISTS Messages (id INT AUTO_INCREMENT NOT 
NULL, name VARCHAR(100) NOT NULL, CONSTRAINT pk_Messages PRIMARY
KEY (id))

Currently Exposed doesn't have support for data classes and the repository pattern. It requires the creation of an object of the required structure. 

主站蜘蛛池模板: 济源市| 临高县| 民权县| 屯昌县| 安康市| 正蓝旗| 禹州市| 榕江县| 中阳县| 普陀区| 广饶县| 合江县| 贡山| 阿城市| 崇礼县| 宣恩县| 紫金县| 大渡口区| 江阴市| 汝州市| 东平县| 巨野县| 津市市| 南平市| 萍乡市| 林口县| 红河县| 色达县| 当阳市| 赤水市| 泉州市| 桃园县| 邛崃市| 南京市| 特克斯县| 高州市| 库车县| 巫溪县| 天津市| 资阳市| 绥中县|