Fix jwt-token
This commit is contained in:
@@ -7,8 +7,16 @@
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// Check if the columns already exist
|
||||
const tableDescription = await queryInterface.describeTable('tenants');
|
||||
try {
|
||||
// Check if tenants table exists first
|
||||
const tables = await queryInterface.showAllTables();
|
||||
if (!tables.includes('tenants')) {
|
||||
console.log('⚠️ Tenants table does not exist yet, skipping IP restrictions migration...');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the columns already exist
|
||||
const tableDescription = await queryInterface.describeTable('tenants');
|
||||
|
||||
if (!tableDescription.ip_whitelist) {
|
||||
await queryInterface.addColumn('tenants', 'ip_whitelist', {
|
||||
@@ -45,6 +53,10 @@ module.exports = {
|
||||
} else {
|
||||
console.log('⚠️ Column ip_restriction_message already exists, skipping...');
|
||||
}
|
||||
} 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
|
||||
}
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
|
||||
Reference in New Issue
Block a user