Skip to content

MigrationParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/database-parser/src/parsers/migration.parser.ts

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

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.

Was this page helpful?

Download as PDF