Fix jwt-token
This commit is contained in:
@@ -7,14 +7,10 @@
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
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 allow_registration migration...');
|
||||
return;
|
||||
}
|
||||
// Check if the column already exists
|
||||
const tableDescription = await queryInterface.describeTable('tenants');
|
||||
|
||||
if (!tableDescription.allow_registration) {
|
||||
await queryInterface.addColumn('tenants', 'allow_registration', {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false, // Default to false for security
|
||||
@@ -29,13 +25,10 @@ module.exports = {
|
||||
console.log('✅ Added allow_registration field to tenants table');
|
||||
console.log('⚠️ Registration is disabled by default for all tenants for security');
|
||||
console.log('💡 To enable registration for a tenant, update the allow_registration field to true');
|
||||
} 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
|
||||
} else {
|
||||
console.log('⚠️ Column allow_registration already exists, skipping...');
|
||||
}
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
}, down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('tenants', 'allow_registration');
|
||||
console.log('✅ Removed allow_registration field from tenants table');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user