-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposts.js
37 lines (37 loc) · 899 Bytes
/
posts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict";
module.exports = (sequelize, DataTypes) => {
const posts = sequelize.define(
"posts",
{
PostId: {
type: DataTypes.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
PostTitle: DataTypes.STRING,
PostBody: DataTypes.STRING,
UserId: {
type: DataTypes.INTEGER,
model: "users",
key: "UserId"
},
Username: {
type: DataTypes.STRING,
model: "users",
key: "Username"
},
Deleted: { type: DataTypes.BOOLEAN, defaultValue: false },
createdAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')
},
},
{}
);
posts.associate = function(models) {
// associations can be defined here
};
return posts;
};