diff --git a/server/migrations/20250913000002-add-device-tenant-support.js b/server/migrations/20250913000002-add-device-tenant-support.js index 4af6e35..caf8ac3 100644 --- a/server/migrations/20250913000002-add-device-tenant-support.js +++ b/server/migrations/20250913000002-add-device-tenant-support.js @@ -7,8 +7,16 @@ module.exports = { async up(queryInterface, Sequelize) { - // Check if tenant_id column already exists - const tableDescription = await queryInterface.describeTable('devices'); + try { + // Check if devices table exists first + const tables = await queryInterface.showAllTables(); + if (!tables.includes('devices')) { + console.log('⚠️ Devices table does not exist yet, skipping device tenant support migration...'); + return; + } + + // Check if tenant_id column already exists + const tableDescription = await queryInterface.describeTable('devices'); if (!tableDescription.tenant_id) { // Add tenant_id column to devices table