Skip to content

Commit

Permalink
Add: Migration to add *adphoto* column to Professionals #132
Browse files Browse the repository at this point in the history
  • Loading branch information
renatokano committed Jun 29, 2020
1 parent 9c6ec68 commit 878da8c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions migrations/20200629033313-add-column-ad-photo-to-professionals.js
Original file line number Diff line number Diff line change
@@ -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'
);
}
};
6 changes: 5 additions & 1 deletion models/Professional.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 878da8c

Please sign in to comment.