Skip to main content
Version: 6.2

TSMigrationGenerator

Hierarchy

Index

Constructors

constructor

Methods

createStatement

  • 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

generate

  • 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[] }
    • 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[] }

    Returns string