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.1 KiB

const { Sequelize, DataTypes, where, BIGINT } = require('sequelize');
const sequelize = new Sequelize('iconFont', 'postgres', '2783Rtda', {
host: 'localhost',
dialect:'postgres',
port:3000,
});
const font = sequelize.define('font', {
id :{
type : DataTypes.BIGINT,
primaryKey: true,
autoIncrement:true,
},
name :{
type : DataTypes.STRING,
allowNull: false,
}
})
const iconfont = sequelize.define('iconfont', {
id :{
type : DataTypes.BIGINT,
primaryKey: true,
autoIncrement:true,
},
char :{
type: DataTypes.STRING,
},
svgFile:{
type: DataTypes.STRING,
},
varient:{
type: DataTypes.STRING,
},
name:{
type: DataTypes.STRING,
},
description:{
type: DataTypes.STRING,
},
});
const relations = ()=>{
iconfont.belongsTo(font , {foreignKey: { name: 'iconfontID'} });
font.hasMany(iconfont , {foreignKey: { name: 'iconfontID'}});
sequelize.sync({alter : true});
}
module.exports = {iconfont , font , relations}