From 878da8c8f827e4c5ef7e078072eaa4ba447eeae4 Mon Sep 17 00:00:00 2001 From: renatokano Date: Mon, 29 Jun 2020 02:38:00 -0300 Subject: [PATCH] Add: Migration to add *adphoto* column to Professionals #132 --- ...13-add-column-ad-photo-to-professionals.js | 22 +++++++++++++++++++ models/Professional.js | 6 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 migrations/20200629033313-add-column-ad-photo-to-professionals.js diff --git a/migrations/20200629033313-add-column-ad-photo-to-professionals.js b/migrations/20200629033313-add-column-ad-photo-to-professionals.js new file mode 100644 index 0000000..d6fab56 --- /dev/null +++ b/migrations/20200629033313-add-column-ad-photo-to-professionals.js @@ -0,0 +1,22 @@ +'use strict'; + +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.addColumn( + 'professionals', + 'adphoto', + { + type: Sequelize.STRING(200), + allowNull: true, + defaultValue: "https://res.cloudinary.com/superpets/image/upload/v1592952182/pets/800x500_c1pdhr.jpg" + } + ); + }, + + down: (queryInterface, Sequelize) => { + return queryInterface.removeColumn( + 'pets', + 'adphoto' + ); + } +}; diff --git a/models/Professional.js b/models/Professional.js index d4ffe98..1e209e4 100644 --- a/models/Professional.js +++ b/models/Professional.js @@ -44,7 +44,11 @@ module.exports = (sequelize, Datatypes) => { neighborhood_id: { type: Datatypes.INTEGER, allowNull: false - } + }, + adphoto: { + type: Datatypes.STRING(200), + defaultValue: "https://res.cloudinary.com/superpets/image/upload/v1592952182/pets/800x500_c1pdhr.jpg" + }, }, { timestamps: false, tableName: 'professionals'