- 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.
推薦閱讀
- iOS Game Programming Cookbook
- Visual Basic程序開發(fā)(學(xué)習(xí)筆記)
- 動(dòng)手玩轉(zhuǎn)Scratch3.0編程:人工智能科創(chuàng)教育指南
- DevOps入門與實(shí)踐
- Apache Spark Graph Processing
- 老“碼”識(shí)途
- Learning Laravel's Eloquent
- Webpack實(shí)戰(zhàn):入門、進(jìn)階與調(diào)優(yōu)
- Vue.js 2 Web Development Projects
- Scratch3.0趣味編程動(dòng)手玩:比賽訓(xùn)練營(yíng)
- 零代碼實(shí)戰(zhàn):企業(yè)級(jí)應(yīng)用搭建與案例詳解
- 從零開始學(xué)Android開發(fā)
- Sails.js Essentials
- Python Programming for Arduino
- 少兒編程輕松學(xué)(全2冊(cè))