Skip to content

@iamcalegari/mongoat / defineMigration

Function: defineMigration()

defineMigration(migrationModule): MigrationModule

Defined in: src/migrate/index.ts:40

Identity helper for authoring a migration file — takes the up/down exports and returns them unchanged, giving the author full type inference on MigrationContext without an explicit annotation on the exported object.

Parameters

migrationModule

MigrationModule

The migration's up (required) and down (optional) functions.

Returns

MigrationModule

The same migrationModule, unchanged.

Example

typescript
import { defineMigration } from '@iamcalegari/mongoat';

export default defineMigration({
  async up(ctx) {
    // ...
  },
});