Make project table associated with the user

This commit is contained in:
Takeshi Kimata
2024-05-22 22:33:21 +09:00
parent 704f20239e
commit 7a0bb63e7b
17 changed files with 174 additions and 24 deletions

View File

@@ -8,6 +8,19 @@ function defineProject(sequelize, DataTypes) {
type: DataTypes.STRING,
allowNull: true,
},
isPublic: {
type: DataTypes.BOOLEAN,
allowNull: false,
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'user',
key: 'id',
},
onDelete: 'CASCADE',
},
});
Project.associate = (models) => {