| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 'use strict';
- /** @type {import('sequelize-cli').Migration} */
- module.exports = {
- async up (queryInterface, Sequelize) {
- await queryInterface.createTable('favorites', {
- favorite_id: {
- allowNull: false,
- autoIncrement: true,
- primaryKey: true,
- type: Sequelize.DataTypes.INTEGER
- },
- client_id: {
- type: Sequelize.DataTypes.INTEGER,
- allowNull: false,
- references: {
- model: 'clients',
- key: 'client_id'
- },
- onDelete: 'CASCADE',
- onUpdate: 'CASCADE'
- },
- hall_id: {
- type: Sequelize.DataTypes.INTEGER,
- allowNull: true,
- references: {
- model: 'halls',
- key: 'hall_id'
- },
- onDelete: 'CASCADE'
- },
- photographer_id: {
- type: Sequelize.DataTypes.INTEGER,
- allowNull: true,
- references: {
- model: 'photographers',
- key: 'photographer_id'
- },
- onDelete: 'CASCADE'
- }
- });
- },
- async down (queryInterface, Sequelize) {
- await queryInterface.dropTable('favorites');
- }
- };
|