Fix jwt-token

This commit is contained in:
2025-09-17 06:41:05 +02:00
parent faa2a15b5a
commit a0e0343989
4 changed files with 49 additions and 6 deletions

View File

@@ -7,7 +7,15 @@
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn('tenants', 'allow_registration', {
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;
}
await queryInterface.addColumn('tenants', 'allow_registration', {
type: Sequelize.BOOLEAN,
defaultValue: false, // Default to false for security
allowNull: false,
@@ -21,6 +29,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
}
},
down: async (queryInterface, Sequelize) => {