module.exports = {
    /**
     * @param {QueryInterface} queryInterface
     * @param {Sequelize} Sequelize
     * @returns {Promise<void>}
     */
    async up(queryInterface, Sequelize) {
        /**
         * @type {Transaction}
         */
        const transaction = await queryInterface.sequelize.transaction();
        try {
            
                
                    await queryInterface.createTable('users', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('roles', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('permissions', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('organizations', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('assets', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('data_sources', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('ingestion_pipelines', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('telemetry_events', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('ai_models', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('detections', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('incidents', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('response_playbooks', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('response_actions', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('soc_agents', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('threat_actors', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('threat_indicators', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('threat_campaigns', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('attack_map_events', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('risk_assessments', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('simulation_labs', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('simulation_runs', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('infrastructure_clusters', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('edge_sensors', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('reports', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    await queryInterface.createTable('ai_recommendations', {
                        id: {
                            type: Sequelize.DataTypes.UUID,
                            defaultValue: Sequelize.DataTypes.UUIDV4,
                            primaryKey: true,
                        },
                        createdById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        updatedById: {
                            type: Sequelize.DataTypes.UUID,
                            references: {
                                key: 'id',
                                model: 'users',
                            },
                        },
                        createdAt: { type: Sequelize.DataTypes.DATE },
                        updatedAt: { type: Sequelize.DataTypes.DATE },
                        deletedAt: { type: Sequelize.DataTypes.DATE },
                        importHash: {
                            type: Sequelize.DataTypes.STRING(255),
                            allowNull: true,
                          unique: true, 
                        },
                    }, { transaction });
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'firstName',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'lastName',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'phoneNumber',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'email',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'disabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'password',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerified',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerificationToken',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'emailVerificationTokenExpiresAt',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'passwordResetToken',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'passwordResetTokenExpiresAt',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'provider',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'app_roleId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'roles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'users',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'role_customization',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'globalAccess',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'permissions',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'organizations',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'asset_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['host','server','workstation','container','kubernetes_cluster','database','application','api','network_device','iot','edge_sensor'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'environment',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'ip_address',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'hostname',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'os',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'cloud_provider',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'criticality',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high','critical'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'internet_exposed',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'assets',
                      'sensorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'edge_sensors',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'source_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['siem','edr','ids_ips','firewall','proxy','dns','cloud_logs','kubernetes_audit','endpoint','threat_feed','dark_web','vulnerability_scanner','email_gateway','web_gateway','custom_api'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['active','paused','error','onboarding'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'connector_type',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'endpoint_url',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'auth_method',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'poll_interval_seconds',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'last_ingested_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'data_sources',
                      'notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'pipeline_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['log_collector','kafka_stream','batch_etl','webhook','file_drop'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['healthy','degraded','down','maintenance'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'kafka_topic',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'data_lake_path',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'throughput_eps',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'error_rate_percent',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'last_health_check_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ingestion_pipelines',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'data_sourceId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'data_sources',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'assetId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'assets',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'observed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'event_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['auth','process','network','dns','http','email','file','cloud','kubernetes','iam','vulnerability','threat_feed','dark_web'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'severity',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['informational','low','medium','high','critical'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'raw_payload',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'hash',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'telemetry_events',
                      'flagged',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'model_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['anomaly_detection','malware_detection','phishing_detection','ransomware_detection','risk_scoring','recommendation','soc_agent_policy'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','staging','active','deprecated'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'version',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'framework',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'artifact_uri',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'threshold',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'trained_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'activated_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_models',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'eventId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'telemetry_events',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'modelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ai_models',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'detected_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'detection_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['anomaly','malware','phishing','ransomware','lateral_movement','data_exfiltration','policy_violation'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['new','triaged','confirmed','false_positive','suppressed'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'confidence',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'risk_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'evidence',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'detections',
                      'requires_response',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'severity',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high','critical'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['open','investigating','contained','eradicated','recovered','closed'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'opened_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'closed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'assigneeId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'incidents',
                      'business_impact_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'category',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['containment','eradication','recovery','notification','hunting','enrichment'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','active','disabled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'trigger_conditions',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'steps',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'requires_approval',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'expected_duration_minutes',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_playbooks',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'incidentId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'incidents',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'playbookId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'response_playbooks',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'action_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['isolate_host','block_ip','block_domain','disable_user','reset_credentials','quarantine_file','kill_process','revoke_token','rotate_keys','patch','restore_backup','notify','create_ticket'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['queued','running','succeeded','failed','canceled','requires_approval'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'requested_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'executed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'requested_byId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'target',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'action_result',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'automated',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'response_actions',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'agent_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['autonomous_soc_agent','automation_engine','self_healing_network_controller'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['online','offline','degraded','training'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'modelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ai_models',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'capabilities',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'approval_required_by_default',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'last_heartbeat_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'actions_success_rate',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'soc_agents',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'actor_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['apt','cybercrime_group','insider','hacktivist','unknown'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'motivation',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['financial','espionage','disruption','ideology','unknown'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'origin_country',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'aliases',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'profile',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'threat_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'first_seen_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'last_seen_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_actors',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'indicator_value',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'indicator_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['ip','domain','url','hash','email','certificate','user_agent'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'confidence',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'severity',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high','critical'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'threat_actorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'threat_actors',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'first_seen_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'last_seen_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'source',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'context',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_indicators',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'threat_actorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'threat_actors',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['active','dormant','ended'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'start_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'end_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'global_risk_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'threat_campaigns',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'occurred_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'event_kind',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['scan','intrusion_attempt','malware_delivery','phishing','ddos','ransomware','c2_activity','data_exfiltration'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'source_country',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'source_ip',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'destination_country',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'destination_ip',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'latitude',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'longitude',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'risk_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'indicatorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'threat_indicators',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'attack_map_events',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'assessed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'scope',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['organization','business_unit','asset','application','cloud_account'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'assetId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'assets',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'overall_risk_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'risk_level',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['low','medium','high','critical'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'top_risks',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'risk_assessments',
                      'recommendations',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'lab_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['attack_simulation','digital_twin','ai_hacker_simulator'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['available','running','maintenance','offline'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'created_on',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_labs',
                      'max_duration_minutes',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'labId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'simulation_labs',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'initiated_byId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'scenario_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['phishing','ransomware','malware_outbreak','insider_threat','cloud_misconfig','lateral_movement','ddos'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['queued','running','completed','failed','canceled'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'started_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'ended_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'success_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'findings',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'simulation_runs',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'cluster_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['kubernetes','gpu_cluster','storage_cluster','edge_fleet'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['healthy','degraded','down'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'region',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'provider',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'api_gateway_url',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'cpu_capacity',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'gpu_capacity',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'storage_capacity_tb',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'last_audit_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'infrastructure_clusters',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['online','offline','degraded'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'location',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'site',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'hardware_model',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'firmware_version',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'last_seen_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'clusterId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'infrastructure_clusters',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'edge_sensors',
                      'organizationsId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'report_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['executive_summary','incident_report','threat_intel_digest','compliance','risk_overview','monthly_soc_metrics'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','published','archived'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'period_start_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'period_end_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'content',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'reports',
                      'authorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'organizationId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'organizations',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'incidentId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'incidents',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'modelId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ai_models',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'generated_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'recommendation_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['containment','hardening','hunting_query','policy_change','patching','user_training','architecture_change'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['new','accepted','rejected','implemented'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'estimated_risk_reduction',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ai_recommendations',
                      'details',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
            
            
            await transaction.commit();
        } catch (err) {
            await transaction.rollback();
            throw err;
        }
    },
    /**
     * @param {QueryInterface} queryInterface
     * @param {Sequelize} Sequelize
     * @returns {Promise<void>}
     */
    async down(queryInterface, Sequelize) {
        /**
         * @type {Transaction}
         */
        const transaction = await queryInterface.sequelize.transaction();
        try {
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'details',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'estimated_risk_reduction',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'recommendation_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'generated_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'modelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'incidentId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_recommendations',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'authorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'content',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'period_end_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'period_start_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'report_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'reports',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'clusterId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'last_seen_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'firmware_version',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'hardware_model',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'site',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'location',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'edge_sensors',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'last_audit_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'storage_capacity_tb',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'gpu_capacity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'cpu_capacity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'api_gateway_url',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'provider',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'region',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'cluster_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'infrastructure_clusters',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'findings',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'success_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'ended_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'started_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'scenario_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'initiated_byId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_runs',
                        'labId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'max_duration_minutes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'created_on',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'lab_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'simulation_labs',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'recommendations',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'top_risks',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'risk_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'overall_risk_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'assetId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'scope',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'assessed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'risk_assessments',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'indicatorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'risk_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'longitude',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'latitude',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'destination_ip',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'destination_country',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'source_ip',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'source_country',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'event_kind',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'attack_map_events',
                        'occurred_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'global_risk_score',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'end_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'start_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'threat_actorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_campaigns',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'context',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'source',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'last_seen_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'first_seen_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'threat_actorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'severity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'confidence',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'indicator_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_indicators',
                        'indicator_value',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'last_seen_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'first_seen_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'threat_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'profile',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'aliases',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'origin_country',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'motivation',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'actor_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'threat_actors',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'actions_success_rate',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'last_heartbeat_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'approval_required_by_default',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'capabilities',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'modelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'agent_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'soc_agents',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'automated',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'action_result',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'target',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'requested_byId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'executed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'requested_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'action_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'playbookId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_actions',
                        'incidentId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'expected_duration_minutes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'requires_approval',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'steps',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'trigger_conditions',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'category',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'response_playbooks',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'business_impact_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'assigneeId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'closed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'opened_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'severity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'incidents',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'requires_response',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'evidence',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'risk_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'confidence',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'detection_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'detected_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'modelId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'eventId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'detections',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'activated_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'trained_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'threshold',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'artifact_uri',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'framework',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'version',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'model_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ai_models',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'flagged',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'hash',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'raw_payload',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'severity',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'event_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'observed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'assetId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'data_sourceId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'telemetry_events',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'last_health_check_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'error_rate_percent',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'throughput_eps',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'data_lake_path',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'kafka_topic',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'pipeline_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ingestion_pipelines',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'last_ingested_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'poll_interval_seconds',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'auth_method',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'endpoint_url',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'connector_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'source_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'data_sources',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'sensorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'internet_exposed',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'criticality',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'cloud_provider',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'os',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'hostname',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'ip_address',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'environment',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'asset_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'assets',
                        'organizationId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'organizations',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'permissions',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'globalAccess',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'role_customization',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'organizationsId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'app_roleId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'provider',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'passwordResetTokenExpiresAt',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'passwordResetToken',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerificationTokenExpiresAt',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerificationToken',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'emailVerified',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'password',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'disabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'email',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'phoneNumber',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'lastName',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'users',
                        'firstName',
                        { transaction }
                    );
                
            
                
                    await queryInterface.dropTable('ai_recommendations', { transaction });
                
            
                
                    await queryInterface.dropTable('reports', { transaction });
                
            
                
                    await queryInterface.dropTable('edge_sensors', { transaction });
                
            
                
                    await queryInterface.dropTable('infrastructure_clusters', { transaction });
                
            
                
                    await queryInterface.dropTable('simulation_runs', { transaction });
                
            
                
                    await queryInterface.dropTable('simulation_labs', { transaction });
                
            
                
                    await queryInterface.dropTable('risk_assessments', { transaction });
                
            
                
                    await queryInterface.dropTable('attack_map_events', { transaction });
                
            
                
                    await queryInterface.dropTable('threat_campaigns', { transaction });
                
            
                
                    await queryInterface.dropTable('threat_indicators', { transaction });
                
            
                
                    await queryInterface.dropTable('threat_actors', { transaction });
                
            
                
                    await queryInterface.dropTable('soc_agents', { transaction });
                
            
                
                    await queryInterface.dropTable('response_actions', { transaction });
                
            
                
                    await queryInterface.dropTable('response_playbooks', { transaction });
                
            
                
                    await queryInterface.dropTable('incidents', { transaction });
                
            
                
                    await queryInterface.dropTable('detections', { transaction });
                
            
                
                    await queryInterface.dropTable('ai_models', { transaction });
                
            
                
                    await queryInterface.dropTable('telemetry_events', { transaction });
                
            
                
                    await queryInterface.dropTable('ingestion_pipelines', { transaction });
                
            
                
                    await queryInterface.dropTable('data_sources', { transaction });
                
            
                
                    await queryInterface.dropTable('assets', { transaction });
                
            
                
                    await queryInterface.dropTable('organizations', { transaction });
                
            
                
                    await queryInterface.dropTable('permissions', { transaction });
                
            
                
                    await queryInterface.dropTable('roles', { transaction });
                
            
                
                    await queryInterface.dropTable('users', { transaction });
                
            
            await transaction.commit();
        } catch (err) {
            await transaction.rollback();
            throw err;
        }
    }
};
