inital commit
This commit is contained in:
51
migrations/20240614154022-create-event.js
Normal file
51
migrations/20240614154022-create-event.js
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('Events', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
title: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
description: {
|
||||
type: Sequelize.TEXT
|
||||
},
|
||||
date: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false
|
||||
},
|
||||
repeat: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
interval: {
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
institution_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'institutions',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL'
|
||||
},
|
||||
event_place_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'event_places',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL'
|
||||
}
|
||||
});
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('Events');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user