# MigrationParser

**Kind:** Class

**Source:** [`atloria-monorepo/apps/database-parser/src/parsers/migration.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/database-parser/src/parsers/migration.parser.ts#L90)

**Implements:** `IParser`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `initialize` | `initialize(config: ParserConfig)` | `Promise<void>` |
| `canParse` | `canParse(filePath: string)` | `boolean` |
| `parseFile` | `parseFile(filePath: string, content: string)` | `Promise<ParseResult>` |
| `parseFiles` | `parseFiles(files: ParseFileInput[])` | `Promise<ParseResult[]>` |
| `destroy` | `destroy()` | `Promise<void>` |

## Properties

| Property | Type |
|---|---|
| `name` | `any` |
| `version` | `any` |
| `supportedPatterns` | `any` |

## Where it refuses work

- `MigrationParser` stops the work with an early return when `!onActions`, in 2 places.
- `MigrationParser` stops the work with an early return when `!action`, in 2 places.
- `MigrationParser` stops the work with an early return when `value === 'CASCADE' || value === 'SET_NULL' || value === 'RESTRICT' || value === 'NO_ACTI…`, in 2 places.
- `MigrationParser` stops the work with an early return when `!this.canParse(filePath)`.
- `MigrationParser` stops the work with an early return when `filePath.includes('/prisma/migrations/')`.
- `MigrationParser` stops the work with an early return when `filePath.includes('/typeorm/migrations/') || filePath.match(/\d{13}-\w+\.ts$/)`.

## When something fails

- `MigrationParser` handles failure in 3 places: it logs it and continues in 2, and turns it into a return value in 1.
