mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
- Adds a volume field in the keyword table. - Adds a button in the Adwords Integration screen to update all the tracked keywords. - When a new keyword is added, the volume data is automatically fetched. - Adds ability to sort keywords based on search volume.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
// Migration: Adds volume field to the keyword table.
|
|
|
|
// CLI Migration
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
return queryInterface.sequelize.transaction(async (t) => {
|
|
try {
|
|
const keywordTableDefinition = await queryInterface.describeTable('keyword');
|
|
if (keywordTableDefinition) {
|
|
if (!keywordTableDefinition.volume) {
|
|
await queryInterface.addColumn('keyword', 'volume', {
|
|
type: Sequelize.DataTypes.STRING, allowNull: false, defaultValue: 0,
|
|
}, { transaction: t });
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.log('error :', error);
|
|
}
|
|
});
|
|
},
|
|
down: (queryInterface) => {
|
|
return queryInterface.sequelize.transaction(async (t) => {
|
|
try {
|
|
const keywordTableDefinition = await queryInterface.describeTable('keyword');
|
|
if (keywordTableDefinition) {
|
|
if (keywordTableDefinition.volume) {
|
|
await queryInterface.removeColumn('keyword', 'volume', { transaction: t });
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.log('error :', error);
|
|
}
|
|
});
|
|
},
|
|
};
|