Skip to content

MigrationParser

reference
1 min readUpdated

Kind: Class

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

Migration Parser implementation

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 !this.canParse(filePath).
  • MigrationParser stops the work with an early return when !fileContent.trim().
  • 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/') || /\d{13}-\w+\.ts$/.test(filePath).
  • MigrationParser stops the work with an early return when /^V\d+__/.test(filePath.split('/').pop() || '').
  • MigrationParser stops the work with an early return when filePath.includes('changelog').

When something fails

  • MigrationParser handles failure in 4 places: it turns it into a return value in 3, and logs it and continues in 1.

Was this page helpful?

Download as PDF