Fix jwt-token
This commit is contained in:
@@ -111,7 +111,8 @@ async function startServer() {
|
|||||||
// Always sync database in containerized environments or development
|
// Always sync database in containerized environments or development
|
||||||
// Check if tables exist before syncing
|
// Check if tables exist before syncing
|
||||||
try {
|
try {
|
||||||
await sequelize.sync({ force: false, alter: false });
|
// Enable alter to add new columns like raw_payload
|
||||||
|
await sequelize.sync({ force: false, alter: true });
|
||||||
console.log('Database synchronized.');
|
console.log('Database synchronized.');
|
||||||
|
|
||||||
// Seed database with initial data
|
// Seed database with initial data
|
||||||
|
|||||||
31
server/migrations/20250910-add-raw-payload-fields.js
Normal file
31
server/migrations/20250910-add-raw-payload-fields.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
async up(queryInterface, Sequelize) {
|
||||||
|
// Add raw_payload column to drone_detections table
|
||||||
|
await queryInterface.addColumn('drone_detections', 'raw_payload', {
|
||||||
|
type: Sequelize.JSON,
|
||||||
|
allowNull: true,
|
||||||
|
comment: 'Complete raw payload received from detector (for debugging)'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add raw_payload column to heartbeats table
|
||||||
|
await queryInterface.addColumn('heartbeats', 'raw_payload', {
|
||||||
|
type: Sequelize.JSON,
|
||||||
|
allowNull: true,
|
||||||
|
comment: 'Complete raw payload received from detector (for debugging)'
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('✅ Added raw_payload fields to drone_detections and heartbeats tables');
|
||||||
|
},
|
||||||
|
|
||||||
|
async down(queryInterface, Sequelize) {
|
||||||
|
// Remove raw_payload column from drone_detections table
|
||||||
|
await queryInterface.removeColumn('drone_detections', 'raw_payload');
|
||||||
|
|
||||||
|
// Remove raw_payload column from heartbeats table
|
||||||
|
await queryInterface.removeColumn('heartbeats', 'raw_payload');
|
||||||
|
|
||||||
|
console.log('✅ Removed raw_payload fields from drone_detections and heartbeats tables');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user