create folders table

This commit is contained in:
Takeshi Kimata
2024-02-12 12:20:37 +09:00
parent 8de8d06399
commit 197a011c4c
13 changed files with 261 additions and 32 deletions

View File

@@ -14,7 +14,7 @@ module.exports = {
},
detail: {
type: Sequelize.STRING,
allowNull: false,
allowNull: true,
},
createdAt: {
type: Sequelize.DATE,

View File

@@ -0,0 +1,48 @@
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('folders', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
detail: {
type: Sequelize.STRING,
allowNull: true,
},
parentFolderId: {
type: Sequelize.INTEGER,
allowNull: true,
},
projectId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'Projects',
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
},
async down (queryInterface, Sequelize) {
await queryInterface.dropTable('folders');
}
};