const { DataTypes } = require('sequelize'); module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.createTable('model_versions', { id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false }, model_name: { type: DataTypes.STRING, allowNull: false }, version: { type: DataTypes.STRING, allowNull: false }, model_type: { type: DataTypes.ENUM('MODEL1', 'QUERYMODEL'), allowNull: false }, base_model: { type: DataTypes.STRING, allowNull: false }, fine_tuning_method: { type: DataTypes.ENUM('SFT', 'DPO', 'PPO', 'LoRA', 'QLoRA'), allowNull: true }, training_data_count: { type: DataTypes.INTEGER, defaultValue: 0, allowNull: false }, performance_metrics: { type: DataTypes.JSONB, defaultValue: {}, allowNull: false }, is_active: { type: DataTypes.BOOLEAN, defaultValue: false, allowNull: false }, deployment_status: { type: DataTypes.ENUM('training', 'testing', 'deployed', 'deprecated'), defaultValue: 'training', allowNull: false }, model_path: { type: DataTypes.STRING, allowNull: true }, hyperparameters: { type: DataTypes.JSONB, defaultValue: {}, allowNull: false }, training_log: { type: DataTypes.JSONB, defaultValue: {}, allowNull: false }, metadata: { type: DataTypes.JSONB, defaultValue: {}, allowNull: false }, created_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW }, updated_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW } }); // Create indexes await queryInterface.addIndex('model_versions', ['model_name']); await queryInterface.addIndex('model_versions', ['model_type']); await queryInterface.addIndex('model_versions', ['is_active']); await queryInterface.addIndex('model_versions', ['deployment_status']); await queryInterface.addIndex('model_versions', ['created_at']); }, down: async (queryInterface, Sequelize) => { await queryInterface.dropTable('model_versions'); } };