import { Model } from 'mongoose';
import { ConfigDocument } from '../config.model';
import { Migration } from '../registry/migration.interface';

export const migration_v2: Migration = {
	version: 2,
	name: 'Example migration - add new config',
	up: async (configModel: Model<ConfigDocument>) => {
		console.log('Migration 2: up - starting example migration');
		
		await configModel.findOneAndUpdate(
			{ key: 'example_key' },
			{ 
				key: 'example_key', 
				value: 'example_value',
				description: 'Example configuration added by migration'
			},
			{ upsert: true, new: true }
		);
		
		console.log('Migration 2: up - example migration completed');
	}
};

