import { Migrations } from '@convex-dev/migrations';

import { components } from './_generated/api';
import type { DataModel } from './_generated/dataModel';

/**
 * The migrations runner (component-backed: batched, resumable, idempotent, dry-runnable).
 * Define one-off data migrations here with `migrations.define({ table, migrateOne })`, then
 * run with `npx convex run migrations:<name>` (`--prod` for production, `'{"dryRun": true}'`
 * to preview). See docs/engineering/migrations.md for the widen→migrate→narrow process.
 *
 * The `clearSortAt` migration that dropped the deprecated `sortAt` column lived here and was
 * removed once complete (its worked example is preserved in the runbook).
 */
export const migrations = new Migrations<DataModel>(components.migrations);
