You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.5 KiB
65 lines
1.5 KiB
/* eslint-disable*/
|
|
|
|
'use strict';
|
|
|
|
module.exports = dc => {
|
|
const DataTypes = dc.ORM;
|
|
const sequelize = dc.orm;
|
|
const BookChapterContent = sequelize.define("bookChapterContent", {
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: "内容ID",
|
|
primaryKey: true,
|
|
field: "id",
|
|
autoIncrement: true
|
|
},
|
|
chapterId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: "章节ID",
|
|
primaryKey: false,
|
|
field: "chapter_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "bookChapter"
|
|
}
|
|
},
|
|
content: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "章节内容(Markdown格式)",
|
|
primaryKey: false,
|
|
field: "content",
|
|
autoIncrement: false
|
|
},
|
|
version: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 1,
|
|
comment: "内容版本号",
|
|
primaryKey: false,
|
|
field: "version",
|
|
autoIncrement: false
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
|
comment: "创建时间",
|
|
primaryKey: false,
|
|
field: "created_at",
|
|
autoIncrement: false
|
|
}
|
|
}, {
|
|
tableName: "book_chapter_contents",
|
|
comment: "章节内容表",
|
|
indexes: []
|
|
});
|
|
dc.models.BookChapterContent = BookChapterContent;
|
|
return BookChapterContent;
|
|
};
|