四好公路
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.

61 lines
1.3 KiB

3 years ago
/* eslint-disable*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const Places = sequelize.define("places", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "places_id_uindex"
},
name: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "场所名称",
primaryKey: false,
field: "name",
autoIncrement: false
},
describe: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "描述",
primaryKey: false,
field: "describe",
autoIncrement: false
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: false,
field: "userId",
autoIncrement: false,
references: {
key: "id",
model: "user"
}
},
}, {
tableName: "places",
comment: "",
indexes: []
});
dc.models.Places = Places;
const User = dc.models.User;
Places.belongsTo(User, { foreignKey: 'userId', targetKey: 'id' });
User.hasMany(Places, { foreignKey: 'userId', sourceKey: 'id' });
return Places;
};