Skip to main content
Version: Next

SqlSchemaGenerator

Hierarchy

Implements

Index

Constructors

constructor

Methods

clearDatabase

  • Parameters

    Returns Promise<void>

createDatabase

  • createDatabase(name?: string): Promise<void>
  • creates new database and connects to it


    Parameters

    • optionalname: string

    Returns Promise<void>

createNamespace

  • createNamespace(name: string): Promise<void>
  • Parameters

    • name: string

    Returns Promise<void>

createSchema

  • Parameters

    Returns Promise<void>

diffToSQL

  • diffToSQL(schemaDiff: SchemaDifference, options: { dropTables?: boolean; safe?: boolean; schema?: string; wrap?: boolean }): Promise<string>
  • Parameters

    • schemaDiff: SchemaDifference
    • options: { dropTables?: boolean; safe?: boolean; schema?: string; wrap?: boolean }
      • optionaldropTables: boolean
      • optionalsafe: boolean
      • optionalschema: string
      • optionalwrap: boolean

    Returns Promise<string>

dropDatabase

  • dropDatabase(name?: string): Promise<void>
  • Parameters

    • optionalname: string

    Returns Promise<void>

dropNamespace

  • dropNamespace(name: string): Promise<void>
  • Parameters

    • name: string

    Returns Promise<void>

dropSchema

  • Parameters

    Returns Promise<void>

ensureDatabase

  • Returns true if the database was created.


    Parameters

    Returns Promise<boolean>

ensureIndexes

  • ensureIndexes(): Promise<void>
  • Returns Promise<void>

execute

  • execute(sql: string, options?: { ctx?: any; wrap?: boolean }): Promise<void>
  • Parameters

    • sql: string
    • options: { ctx?: any; wrap?: boolean } = {}
      • optionalctx: any
      • optionalwrap: boolean

    Returns Promise<void>

getCreateSchemaSQL

  • Parameters

    Returns Promise<string>

getDropSchemaSQL

  • Parameters

    Returns Promise<string>

getTargetSchema

  • getTargetSchema(schema?: string): DatabaseSchema
  • Parameters

    • optionalschema: string

    Returns DatabaseSchema

getUpdateSchemaMigrationSQL

  • getUpdateSchemaMigrationSQL(options?: UpdateSchemaOptions<DatabaseSchema>): Promise<{ down: string; up: string }>
  • Parameters

    Returns Promise<{ down: string; up: string }>

getUpdateSchemaSQL

  • Parameters

    Returns Promise<string>

refreshDatabase

  • Parameters

    Returns Promise<void>

updateSchema

  • Parameters

    Returns Promise<void>

staticregister