Fix jwt-token
This commit is contained in:
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
async up(queryInterface, Sequelize) {
|
async up(queryInterface, Sequelize) {
|
||||||
|
try {
|
||||||
|
// Check if tables exist first
|
||||||
|
const tables = await queryInterface.showAllTables();
|
||||||
|
|
||||||
|
// Handle drone_detections table
|
||||||
|
if (!tables.includes('drone_detections')) {
|
||||||
|
console.log('⚠️ drone_detections table does not exist yet, skipping raw_payload migration for this table...');
|
||||||
|
} else {
|
||||||
// Check if raw_payload column exists in drone_detections before adding
|
// Check if raw_payload column exists in drone_detections before adding
|
||||||
const droneDetectionsTable = await queryInterface.describeTable('drone_detections');
|
const droneDetectionsTable = await queryInterface.describeTable('drone_detections');
|
||||||
if (!droneDetectionsTable.raw_payload) {
|
if (!droneDetectionsTable.raw_payload) {
|
||||||
@@ -14,7 +22,12 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
console.log('⏭️ raw_payload field already exists in drone_detections table');
|
console.log('⏭️ raw_payload field already exists in drone_detections table');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle heartbeats table
|
||||||
|
if (!tables.includes('heartbeats')) {
|
||||||
|
console.log('⚠️ heartbeats table does not exist yet, skipping raw_payload migration for this table...');
|
||||||
|
} else {
|
||||||
// Check if raw_payload column exists in heartbeats before adding
|
// Check if raw_payload column exists in heartbeats before adding
|
||||||
const heartbeatsTable = await queryInterface.describeTable('heartbeats');
|
const heartbeatsTable = await queryInterface.describeTable('heartbeats');
|
||||||
if (!heartbeatsTable.raw_payload) {
|
if (!heartbeatsTable.raw_payload) {
|
||||||
@@ -27,6 +40,11 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
console.log('⏭️ raw_payload field already exists in heartbeats table');
|
console.log('⏭️ raw_payload field already exists in heartbeats table');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('⚠️ Migration skipped - tables may not exist yet:', error.message);
|
||||||
|
// Don't throw error, just skip this migration if tables don't exist
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async down(queryInterface, Sequelize) {
|
async down(queryInterface, Sequelize) {
|
||||||
|
|||||||
Reference in New Issue
Block a user