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('brands', {
                        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('brand_voice_profiles', {
                        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('brain_profiles', {
                        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('skill_modules', {
                        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('six_hat_sessions', {
                        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('knowledge_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('knowledge_documents', {
                        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('knowledge_chunks', {
                        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('knowledge_nodes', {
                        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('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('campaign_brain_configs', {
                        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('safety_policies', {
                        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('audit_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('ad_projects', {
                        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('ad_creatives', {
                        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('generation_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('generation_outputs', {
                        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('output_citations', {
                        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('feedback_entries', {
                        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('learning_signals', {
                        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('platform_metrics', {
                        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('sandbox_scenarios', {
                        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('refresh_jobs', {
                        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('approval_reviews', {
                        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(
                      'roles',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'roles',
                      'role_customization',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'permissions',
                      'name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brands',
                      'brand_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brands',
                      'website_url',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brands',
                      'industry',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brands',
                      'primary_market',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'brandId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'brands',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'profile_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'voice_description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'do_say_examples',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'dont_say_examples',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'english_variant',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['en_au','en_us','en_uk'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'reading_level_target',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'formality_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'empathy_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'energy_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'humor_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'risk_tolerance',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'show_reasoning_trace',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brand_voice_profiles',
                      'is_default',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'profile_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'profile_category',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['domain_expert','growth','copywriting','analysis','compliance','strategy','creative','custom'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'goal_statement',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'behavior_rules',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'preferred_sources_description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'citation_strictness',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'creativity_level',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'compliance_strictness',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'brain_profiles',
                      'is_active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'module_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'module_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['thinking_method','compliance','analysis','generation','research','optimization','simulation','creative'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'module_description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'evidence_level',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['high','medium','low','unknown'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'method_steps',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'requires_citations',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'skill_modules',
                      'is_active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'session_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'campaignId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'campaigns',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'ad_projectId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ad_projects',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'prompt_context',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'white_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'red_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'black_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'yellow_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'green_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'six_hat_sessions',
                      'blue_hat_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'source_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['website','document','video','audio','note','dataset'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'source_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'source_url',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'trust_tier',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['gold','silver','bronze','blocked'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'content_domain',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['ndis','compliance','behavioral_science','platform_policy','competitor_research','brand_assets','campaign_reports','general_marketing'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'last_ingested_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'next_refresh_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'auto_refresh_enabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_sources',
                      'refresh_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'knowledge_sourceId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'knowledge_sources',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'document_title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'ingestion_status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['queued','processing','completed','failed','needs_review'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'language',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'published_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'ingested_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'document_summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_documents',
                      'tags_csv',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'knowledge_documentId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'knowledge_documents',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'chunk_label',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'chunk_text',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'source_locator',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'recency_weight',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'quality_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_chunks',
                      'is_sensitive',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_nodes',
                      'node_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_nodes',
                      'node_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['topic','framework','offer','hook','audience_segment','policy','constraint','metric','competitor','custom'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_nodes',
                      'node_description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'knowledge_nodes',
                      'importance_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'brandId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'brands',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'campaign_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'campaign_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['awareness','lead_gen','conversion','retargeting','partnerships','education'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','planned','active','paused','completed','archived'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'objective',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'primary_audience',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'budget_amount',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'budget_currency',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'start_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaigns',
                      'end_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'campaignId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'campaigns',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'brain_profileId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'brain_profiles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'layer_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'priority_order',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'is_enabled',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'campaign_brain_configs',
                      'influence_weight',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'policy_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'enforcement_mode',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['warn','block','allow_with_justification'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'scope',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['global','campaign_specific','sandbox_only'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'policy_rules',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'restricted_topics',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'never_copy_sources',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'citation_required',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'safety_policies',
                      'is_active',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_events',
                      'event_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_events',
                      'actorId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_events',
                      'event_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['ingestion_run','policy_enforced','policy_override','brain_config_changed','generation_created','generation_exported','feedback_recorded','sandbox_published'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_events',
                      'event_summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'audit_events',
                      'event_details',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'campaignId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'campaigns',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'project_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'channel',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['meta','google_search','google_display','tiktok','linkedin','youtube','email','landing_page'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','in_review','approved','scheduled','live','paused','completed'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'brand_voice_profileId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'brand_voice_profiles',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_projects',
                      'creative_brief',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'ad_projectId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ad_projects',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'creative_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'creative_format',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['image','video','carousel','text','landing_page_section','email'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'primary_text',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'headline',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'description_text',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'call_to_action',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
            
                
            
                
                    
                    await queryInterface.addColumn(
                      'ad_creatives',
                      'targeting_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'ad_projectId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ad_projects',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'requested_byId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'run_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['generate','analyze','teardown','compliance_review','ab_test_plan','research_summary'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'requested_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'run_status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['queued','running','completed','failed'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'input_prompt',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'model_label',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'temperature',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_runs',
                      'retrieved_chunk_count',
                      {
                          type: Sequelize.DataTypes.INTEGER,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'generation_runId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'generation_runs',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'output_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['ad_copy','creative_brief','analysis_report','compliance_report','ab_variants','strategy_plan','research_notes'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'output_title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'output_content',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'is_exported',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'generation_outputs',
                      'exported_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'output_citations',
                      'generation_outputId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'generation_outputs',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'output_citations',
                      'knowledge_chunkId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'knowledge_chunks',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'output_citations',
                      'relevance_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'output_citations',
                      'citation_note',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'generation_outputId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'generation_outputs',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'given_byId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'given_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'overall_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'compliance_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'brand_fit_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'conversion_intent_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'empathy_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'risk_boldness_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'feedback_entries',
                      'freeform_notes',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'campaignId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'campaigns',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'signal_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['metric_import','ab_result','audience_comment','competitor_change','seasonal_pattern','manual_insight'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'signal_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'signal_title',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'signal_details',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'confidence_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'learning_signals',
                      'applied_to_brain',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'ad_projectId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'ad_projects',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'platform',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['meta','google','tiktok','linkedin','youtube','email'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'metric_date',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'spend',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'impressions',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'clicks',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'ctr',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'conversions',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'cpa',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'platform_metrics',
                      'roas',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'scenario_name',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'scenario_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['mock_campaign','mock_client_call','policy_stress_test','competitor_teardown','compliance_drill','prompt_regression'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'scenario_description',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'campaign_brain_configId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'campaign_brain_configs',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'safety_policyId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'safety_policies',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['draft','running','completed','approved','rejected'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'sandbox_scenarios',
                      'last_run_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'knowledge_sourceId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'knowledge_sources',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'job_type',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['crawl','transcribe','extract_text','reembed','policy_update','behavioral_science_update'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'job_status',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['scheduled','running','completed','failed','awaiting_approval'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'scheduled_for',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'started_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'finished_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'job_summary',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'job_log',
                      {
                          type: Sequelize.DataTypes.TEXT,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'refresh_jobs',
                      'approval_required',
                      {
                          type: Sequelize.DataTypes.BOOLEAN,
                          
                            defaultValue: false,
                            allowNull: false,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'review_target',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['refresh_job','knowledge_document','knowledge_chunk','safety_policy','brain_profile','skill_module'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'reviewed_byId',
                      {
                          type: Sequelize.DataTypes.UUID,
                          
                          
                          
                            references: {
                                model: 'users',
                                key: 'id',
                            },
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'reviewed_at',
                      {
                          type: Sequelize.DataTypes.DATE,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'decision',
                      {
                          type: Sequelize.DataTypes.ENUM,
                          
                          
                            values: ['approved','approved_with_changes','rejected'],
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'alignment_score',
                      {
                          type: Sequelize.DataTypes.DECIMAL,
                          
                          
                          
                      },
                      { transaction }
                    );
                
            
                
                    
                    await queryInterface.addColumn(
                      'approval_reviews',
                      'review_notes',
                      {
                          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(
                        'approval_reviews',
                        'review_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'approval_reviews',
                        'alignment_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'approval_reviews',
                        'decision',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'approval_reviews',
                        'reviewed_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'approval_reviews',
                        'reviewed_byId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'approval_reviews',
                        'review_target',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'approval_required',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'job_log',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'job_summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'finished_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'started_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'scheduled_for',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'job_status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'job_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'refresh_jobs',
                        'knowledge_sourceId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'last_run_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'safety_policyId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'campaign_brain_configId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'scenario_description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'scenario_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'sandbox_scenarios',
                        'scenario_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'roas',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'cpa',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'conversions',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'ctr',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'clicks',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'impressions',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'spend',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'metric_date',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'platform',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'platform_metrics',
                        'ad_projectId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'applied_to_brain',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'confidence_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'signal_details',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'signal_title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'signal_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'signal_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'learning_signals',
                        'campaignId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'freeform_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'risk_boldness_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'empathy_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'conversion_intent_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'brand_fit_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'compliance_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'overall_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'given_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'given_byId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'feedback_entries',
                        'generation_outputId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'output_citations',
                        'citation_note',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'output_citations',
                        'relevance_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'output_citations',
                        'knowledge_chunkId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'output_citations',
                        'generation_outputId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'exported_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'is_exported',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'output_content',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'output_title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'output_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_outputs',
                        'generation_runId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'retrieved_chunk_count',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'temperature',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'model_label',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'input_prompt',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'run_status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'requested_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'run_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'requested_byId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'generation_runs',
                        'ad_projectId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'targeting_notes',
                        { transaction }
                    );
                
            
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'call_to_action',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'description_text',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'headline',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'primary_text',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'creative_format',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'creative_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_creatives',
                        'ad_projectId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'creative_brief',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'brand_voice_profileId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'channel',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'project_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'ad_projects',
                        'campaignId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_events',
                        'event_details',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_events',
                        'event_summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_events',
                        'event_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_events',
                        'actorId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'audit_events',
                        'event_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'is_active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'citation_required',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'never_copy_sources',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'restricted_topics',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'policy_rules',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'scope',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'enforcement_mode',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'safety_policies',
                        'policy_name',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'influence_weight',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'is_enabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'priority_order',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'layer_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'brain_profileId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaign_brain_configs',
                        'campaignId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'end_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'start_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'budget_currency',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'budget_amount',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'primary_audience',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'objective',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'campaign_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'campaign_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'campaigns',
                        'brandId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_nodes',
                        'importance_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_nodes',
                        'node_description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_nodes',
                        'node_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_nodes',
                        'node_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'is_sensitive',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'quality_score',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'recency_weight',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'source_locator',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'chunk_text',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'chunk_label',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_chunks',
                        'knowledge_documentId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'tags_csv',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'document_summary',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'ingested_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'published_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'language',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'ingestion_status',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'document_title',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_documents',
                        'knowledge_sourceId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'refresh_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'auto_refresh_enabled',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'next_refresh_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'last_ingested_at',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'content_domain',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'trust_tier',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'source_url',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'source_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'knowledge_sources',
                        'source_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'blue_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'green_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'yellow_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'black_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'red_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'white_hat_notes',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'prompt_context',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'ad_projectId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'campaignId',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'six_hat_sessions',
                        'session_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'is_active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'requires_citations',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'method_steps',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'evidence_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'module_description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'module_type',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'skill_modules',
                        'module_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'is_active',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'compliance_strictness',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'creativity_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'citation_strictness',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'preferred_sources_description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'behavior_rules',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'goal_statement',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'profile_category',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brain_profiles',
                        'profile_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'is_default',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'show_reasoning_trace',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'risk_tolerance',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'humor_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'energy_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'empathy_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'formality_level',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'reading_level_target',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'english_variant',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'dont_say_examples',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'do_say_examples',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'voice_description',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'profile_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brand_voice_profiles',
                        'brandId',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'brands',
                        'primary_market',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brands',
                        'industry',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brands',
                        'website_url',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'brands',
                        'brand_name',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'permissions',
                        'name',
                        { transaction }
                    );
                
            
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'role_customization',
                        { transaction }
                    );
                
            
                
                    await queryInterface.removeColumn(
                        'roles',
                        'name',
                        { 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('approval_reviews', { transaction });
                
            
                
                    await queryInterface.dropTable('refresh_jobs', { transaction });
                
            
                
                    await queryInterface.dropTable('sandbox_scenarios', { transaction });
                
            
                
                    await queryInterface.dropTable('platform_metrics', { transaction });
                
            
                
                    await queryInterface.dropTable('learning_signals', { transaction });
                
            
                
                    await queryInterface.dropTable('feedback_entries', { transaction });
                
            
                
                    await queryInterface.dropTable('output_citations', { transaction });
                
            
                
                    await queryInterface.dropTable('generation_outputs', { transaction });
                
            
                
                    await queryInterface.dropTable('generation_runs', { transaction });
                
            
                
                    await queryInterface.dropTable('ad_creatives', { transaction });
                
            
                
                    await queryInterface.dropTable('ad_projects', { transaction });
                
            
                
                    await queryInterface.dropTable('audit_events', { transaction });
                
            
                
                    await queryInterface.dropTable('safety_policies', { transaction });
                
            
                
                    await queryInterface.dropTable('campaign_brain_configs', { transaction });
                
            
                
                    await queryInterface.dropTable('campaigns', { transaction });
                
            
                
                    await queryInterface.dropTable('knowledge_nodes', { transaction });
                
            
                
                    await queryInterface.dropTable('knowledge_chunks', { transaction });
                
            
                
                    await queryInterface.dropTable('knowledge_documents', { transaction });
                
            
                
                    await queryInterface.dropTable('knowledge_sources', { transaction });
                
            
                
                    await queryInterface.dropTable('six_hat_sessions', { transaction });
                
            
                
                    await queryInterface.dropTable('skill_modules', { transaction });
                
            
                
                    await queryInterface.dropTable('brain_profiles', { transaction });
                
            
                
                    await queryInterface.dropTable('brand_voice_profiles', { transaction });
                
            
                
                    await queryInterface.dropTable('brands', { 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;
        }
    }
};
