Skip to main content
Version: Next

LibSqlSchemaHelper

Hierarchy

Index

Constructors

constructor

Accessors

inheritedknex

  • get knex(): Knex<any, any[]>
  • Returns Knex<any, any[]>

inheritedoptions

  • get options(): { createForeignKeyConstraints?: boolean; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string }
  • Returns { createForeignKeyConstraints?: boolean; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string }

    • optionalcreateForeignKeyConstraints?: boolean
    • optionaldisableForeignKeys?: boolean
    • optionalignoreSchema?: string[]
    • optionalmanagementDbName?: string

Methods

inheritedconfigureColumn

  • configureColumn(column: Column, col: ColumnBuilder, knex: Knex<any, any[]>, changedProperties?: Set<string>): ColumnBuilder
  • Parameters

    • column: Column
    • col: ColumnBuilder
    • knex: Knex<any, any[]>
    • optionalchangedProperties: Set<string>

    Returns ColumnBuilder

inheritedconfigureColumnDefault

  • configureColumnDefault(column: Column, col: ColumnBuilder, knex: Knex<any, any[]>, changedProperties?: Set<string>): ColumnBuilder
  • Parameters

    • column: Column
    • col: ColumnBuilder
    • knex: Knex<any, any[]>
    • optionalchangedProperties: Set<string>

    Returns ColumnBuilder

inheritedcreateCheck

  • createCheck(table: CreateTableBuilder, check: CheckDef<unknown>): void
  • Parameters

    • table: CreateTableBuilder
    • check: CheckDef<unknown>

    Returns void

inheritedcreateForeignKey

  • createForeignKey(table: CreateTableBuilder, foreignKey: ForeignKey, schema?: string): void
  • Parameters

    • table: CreateTableBuilder
    • foreignKey: ForeignKey
    • optionalschema: string

    Returns void

inheritedcreateIndex

  • createIndex(table: CreateTableBuilder, index: IndexDef, tableDef: DatabaseTable, createPrimary?: boolean): void
  • Parameters

    • table: CreateTableBuilder
    • index: IndexDef
    • tableDef: DatabaseTable
    • createPrimary: boolean = false

    Returns void

inheritedcreateSchemaBuilder

  • createSchemaBuilder(schema?: string): SchemaBuilder
  • Parameters

    • optionalschema: string

    Returns SchemaBuilder

inheritedcreateTable

  • createTable(tableDef: DatabaseTable, alter?: boolean): SchemaBuilder
  • Parameters

    • tableDef: DatabaseTable
    • optionalalter: boolean

    Returns SchemaBuilder

inheritedcreateTableColumn

  • createTableColumn(table: TableBuilder, column: Column, fromTable: DatabaseTable, changedProperties?: Set<string>, alter?: boolean): undefined | ColumnBuilder
  • Parameters

    • table: TableBuilder
    • column: Column
    • fromTable: DatabaseTable
    • optionalchangedProperties: Set<string>
    • optionalalter: boolean

    Returns undefined | ColumnBuilder

inheriteddatabaseExists

  • databaseExists(connection: Connection, name: string): Promise<boolean>
  • Parameters

    Returns Promise<boolean>

inheriteddisableForeignKeysSQL

  • disableForeignKeysSQL(): string
  • Returns string

inheriteddump

  • dump(builder: string | SchemaBuilder, append: string): Promise<string>
  • Parameters

    • builder: string | SchemaBuilder
    • append: string

    Returns Promise<string>

inheritedenableForeignKeysSQL

  • enableForeignKeysSQL(): string
  • Returns string

inheritedfinalizeTable

  • finalizeTable(table: TableBuilder, charset: string, collate?: string): void
  • Parameters

    • table: TableBuilder
    • charset: string
    • optionalcollate: string

    Returns void

inheritedgetAlterColumnAutoincrement

  • getAlterColumnAutoincrement(tableName: string, column: Column, schemaName?: string): string
  • Parameters

    • tableName: string
    • column: Column
    • optionalschemaName: string

    Returns string

inheritedgetAlterNativeEnumSQL

  • getAlterNativeEnumSQL(name: string, schema?: string, value?: string, items?: string[], oldItems?: string[]): string
  • Parameters

    • name: string
    • optionalschema: string
    • optionalvalue: string
    • optionalitems: string[]
    • optionaloldItems: string[]

    Returns string

inheritedgetAlterTable

  • getAlterTable(changedTable: TableDifference, wrap?: boolean): Promise<string>
  • Parameters

    Returns Promise<string>

inheritedgetChangeColumnCommentSQL

  • getChangeColumnCommentSQL(tableName: string, to: Column, schemaName?: string): string
  • Parameters

    • tableName: string
    • to: Column
    • optionalschemaName: string

    Returns string

inheritedgetChecks

  • Parameters

    Returns Promise<CheckDef<unknown>[]>

inheritedgetColumns

  • Parameters

    Returns Promise<any[]>

inheritedgetCreateDatabaseSQL

  • getCreateDatabaseSQL(name: string): string
  • Parameters

    • name: string

    Returns string

inheritedgetCreateIndexSQL

  • getCreateIndexSQL(tableName: string, index: IndexDef, partialExpression?: boolean): string
  • Parameters

    • tableName: string
    • index: IndexDef
    • partialExpression: boolean = false

    Returns string

inheritedgetCreateNamespaceSQL

  • getCreateNamespaceSQL(name: string): string
  • Parameters

    • name: string

    Returns string

inheritedgetCreateNativeEnumSQL

  • getCreateNativeEnumSQL(name: string, values: unknown[], schema?: string): string
  • Parameters

    • name: string
    • values: unknown[]
    • optionalschema: string

    Returns string

inheritedgetDatabaseExistsSQL

  • getDatabaseExistsSQL(name: string): string
  • Parameters

    • name: string

    Returns string

inheritedgetDatabaseNotExistsError

  • getDatabaseNotExistsError(dbName: string): string
  • Parameters

    • dbName: string

    Returns string

inheritedgetDefaultEmptyString

  • getDefaultEmptyString(): string
  • Returns string

inheritedgetDropColumnsSQL

  • getDropColumnsSQL(tableName: string, columns: Column[], schemaName?: string): string
  • Parameters

    • tableName: string
    • columns: Column[]
    • optionalschemaName: string

    Returns string

inheritedgetDropDatabaseSQL

  • getDropDatabaseSQL(name: string): string
  • Parameters

    • name: string

    Returns string

inheritedgetDropIndexSQL

  • getDropIndexSQL(tableName: string, index: IndexDef): string
  • Parameters

    Returns string

inheritedgetDropNamespaceSQL

  • getDropNamespaceSQL(name: string): string
  • Parameters

    • name: string

    Returns string

inheritedgetDropNativeEnumSQL

  • getDropNativeEnumSQL(name: string, schema?: string): string
  • Parameters

    • name: string
    • optionalschema: string

    Returns string

inheritedgetEnumDefinitions

  • Parameters

    Returns Promise<Dictionary<string[]>>

inheritedgetForeignKeys

  • Parameters

    Returns Promise<Dictionary>

inheritedgetForeignKeysSQL

  • getForeignKeysSQL(tableName: string): string
  • Parameters

    • tableName: string

    Returns string

inheritedgetIndexes

  • Parameters

    Returns Promise<IndexDef[]>

inheritedgetListTablesSQL

  • getListTablesSQL(): string
  • Returns string

inheritedgetManagementDbName

  • getManagementDbName(): string
  • Returns string

inheritedgetNamespaces

  • Parameters

    Returns Promise<string[]>

inheritedgetPostAlterTable

  • Parameters

    Returns string

inheritedgetPreAlterTable

  • Parameters

    Returns string

inheritedgetPrimaryKeys

  • Parameters

    Returns Promise<string[]>

inheritedgetReferencedTableName

  • getReferencedTableName(referencedTableName: string, schema?: string): string
  • Parameters

    • referencedTableName: string
    • optionalschema: string

    Returns string

inheritedgetRenameColumnSQL

  • getRenameColumnSQL(tableName: string, oldColumnName: string, to: Column, schemaName?: string): string
  • Parameters

    • tableName: string
    • oldColumnName: string
    • to: Column
    • optionalschemaName: string

    Returns string

inheritedgetRenameIndexSQL

  • getRenameIndexSQL(tableName: string, index: IndexDef, oldIndexName: string): string
  • Parameters

    • tableName: string
    • index: IndexDef
    • oldIndexName: string

    Returns string

inheritedgetSchemaBeginning

  • getSchemaBeginning(charset: string, disableForeignKeys?: boolean): string
  • Parameters

    • charset: string
    • optionaldisableForeignKeys: boolean

    Returns string

inheritedgetSchemaEnd

  • getSchemaEnd(disableForeignKeys?: boolean): string
  • Parameters

    • optionaldisableForeignKeys: boolean

    Returns string

inheritedgetTablesGroupedBySchemas

  • getTablesGroupedBySchemas(tables: Table[]): Map<undefined | string, Table[]>
  • Parameters

    Returns Map<undefined | string, Table[]>

inheritedhasNonDefaultPrimaryKeyName

  • hasNonDefaultPrimaryKeyName(table: DatabaseTable): boolean
  • Parameters

    • table: DatabaseTable

    Returns boolean

inheritedinferLengthFromColumnType

  • inferLengthFromColumnType(type: string): undefined | number
  • Parameters

    • type: string

    Returns undefined | number

inheritedisImplicitIndex

  • isImplicitIndex(name: string): boolean
  • Implicit indexes will be ignored when diffing


    Parameters

    • name: string

    Returns boolean

inheritedloadInformationSchema

  • loadInformationSchema(schema: DatabaseSchema, connection: AbstractSqlConnection, tables: Table[], schemas?: string[]): Promise<void>
  • Parameters

    Returns Promise<void>

inheritedmapForeignKeys

  • mapForeignKeys(fks: any[], tableName: string): Dictionary
  • Parameters

    • fks: any[]
    • tableName: string

    Returns Dictionary

inheritednormalizeDefaultValue

  • normalizeDefaultValue(defaultValue: string, length?: number, defaultValues?: Dictionary<string[]>): string | number
  • Parameters

    • defaultValue: string
    • optionallength: number
    • defaultValues: Dictionary<string[]> = {}

    Returns string | number

inheritedpushTableQuery

  • pushTableQuery(table: TableBuilder, expression: string, grouping?: string): void
  • Uses raw method injected in AbstractSqlConnection to allow adding custom queries inside alter statements.


    Parameters

    • table: TableBuilder
    • expression: string
    • grouping: string = 'alterTable'

    Returns void

inheritedsplitTableName

  • splitTableName(name: string): [undefined | string, string]
  • Parameters

    • name: string

    Returns [undefined | string, string]

inheritedsupportsSchemaConstraints

  • supportsSchemaConstraints(): boolean
  • Returns boolean