Added migrations, expanded maketalert table
This commit is contained in:
37
app/migrations/20190618103020-expand-maketalert.js
Normal file
37
app/migrations/20190618103020-expand-maketalert.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'size', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'gardenSize', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'price', {
|
||||||
|
type: Sequelize.INTEGER,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'municipality', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'region', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'size', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'gardenSize', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'price', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'municipality', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'region', { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'olxUrl', { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'url', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'realestateOrigin', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'originId', {
|
||||||
|
type: Sequelize.STRING,
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
down: (queryInterface, Sequelize) => {
|
||||||
|
return queryInterface.sequelize.transaction((t) => {
|
||||||
|
return Promise.all([
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'url', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'realestateOrigin', { transaction: t }),
|
||||||
|
queryInterface.removeColumn('MarketAlerts', 'originId', { transaction: t }),
|
||||||
|
queryInterface.addColumn('MarketAlerts', 'olxUrl', {
|
||||||
|
type: Sequelize.STRING
|
||||||
|
}, { transaction: t })
|
||||||
|
])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
module.exports = (sequelize, DataTypes) => {
|
module.exports = (sequelize, DataTypes) => {
|
||||||
const MarketAlert = sequelize.define('MarketAlert', {
|
const MarketAlert = sequelize.define('MarketAlert', {
|
||||||
olxUrl: DataTypes.STRING,
|
url: DataTypes.STRING,
|
||||||
|
realestateOrigin: DataTypes.STRING,
|
||||||
|
originId: DataTypes.STRING,
|
||||||
lastDate: DataTypes.STRING,
|
lastDate: DataTypes.STRING,
|
||||||
email: {
|
email: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
|
|||||||
Reference in New Issue
Block a user