bullpen/backend/migrations/07-create-pitch.js

49 lines
1.1 KiB
JavaScript

'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('Pitches', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
pitchTypeId: {
type: Sequelize.INTEGER,
references: {
model: 'PitchTypes',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
bullpenSessionId: {
type: Sequelize.INTEGER,
references: {
model: 'BullpenSessions',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
aimedArea: {
type: Sequelize.INTEGER
},
hitArea: {
type: Sequelize.INTEGER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('Pitches');
}
};