Skip to main content
Version: Next

TSMigrationGenerator

Hierarchy

Index

Constructors

constructor

Methods

inheritedcreateStatement

  • createStatement(sql: string, padLeft: number): string
  • Creates single migration statement. By default adds this.addSql(sql); to the code.


    Parameters

    • sql: string
    • padLeft: number

    Returns string

inheritedgenerate

  • generate(diff: { down: string[]; up: string[] }, path?: string, name?: string): Promise<[string, string]>
  • Generates the full contents of migration file. Uses generateMigrationFile to get the file contents.


    Parameters

    • diff: { down: string[]; up: string[] }
      • down: string[]
      • up: string[]
    • optionalpath: string
    • optionalname: string

    Returns Promise<[string, string]>

generateMigrationFile

  • generateMigrationFile(className: string, diff: { down: string[]; up: string[] }): string
  • Returns the file contents of given migration.


    Parameters

    • className: string
    • diff: { down: string[]; up: string[] }
      • down: string[]
      • up: string[]

    Returns string