Files
pp-tcms/backend/migrations/20240204090345-create-projects.js
2025-07-20 10:59:57 +09:00

49 lines
1.0 KiB
JavaScript

'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('projects', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
detail: {
type: Sequelize.STRING,
allowNull: true,
},
isPublic: {
type: Sequelize.BOOLEAN,
allowNull: false,
},
userId: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'users',
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
},
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
},
down: async (queryInterface) => {
await queryInterface.dropTable('projects');
},
};