diff --git a/server/index.js b/server/index.js index d40e4f6..deda118 100644 --- a/server/index.js +++ b/server/index.js @@ -80,7 +80,7 @@ async function startServer() { // Always sync database in containerized environments or development // Check if tables exist before syncing try { - await sequelize.sync({ alter: true }); + await sequelize.sync({ force: false, alter: false }); console.log('Database synchronized.'); // Seed database with initial data @@ -89,7 +89,7 @@ async function startServer() { console.error('Database sync error:', syncError); // If sync fails, try force sync (this will drop and recreate tables) console.log('Attempting force sync...'); - await sequelize.sync({ force: false, alter: true }); + await sequelize.sync({ force: true }); console.log('Database force synchronized.'); // Seed database with initial data diff --git a/server/models/DroneDetection.js b/server/models/DroneDetection.js index 500a523..1bc1ea2 100644 --- a/server/models/DroneDetection.js +++ b/server/models/DroneDetection.js @@ -74,8 +74,11 @@ module.exports = (sequelize) => { comment: 'Whether this detection has been processed for alerts' }, threat_level: { - type: DataTypes.ENUM('monitoring', 'low', 'medium', 'high', 'critical'), + type: DataTypes.STRING, allowNull: true, + validate: { + isIn: [['monitoring', 'low', 'medium', 'high', 'critical']] + }, comment: 'Assessed threat level based on RSSI and drone type' }, estimated_distance: {