Skip to main content
Version: Next

SqliteSchemaHelper

Hierarchy

Index

Constructors

constructor

Accessors

inheritedoptions

  • get options(): { createForeignKeyConstraints?: boolean; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string; skipColumns?: Dictionary<(string | RegExp)[]>; skipTables?: (string | RegExp)[] }
  • Returns { createForeignKeyConstraints?: boolean; disableForeignKeys?: boolean; ignoreSchema?: string[]; managementDbName?: string; skipColumns?: Dictionary<(string | RegExp)[]>; skipTables?: (string | RegExp)[] }

    • optionalcreateForeignKeyConstraints?: boolean

      Generate foreign key constraints.

    • optionaldisableForeignKeys?: boolean

      Try to disable foreign key checks during schema operations.

    • optionalignoreSchema?: string[]

      Schema names to ignore when comparing schemas.

    • optionalmanagementDbName?: string

      Database name to use for management operations (e.g., creating/dropping databases).

    • optionalskipColumns?: Dictionary<(string | RegExp)[]>

      Column names or patterns to skip during schema generation, keyed by table name.

    • optionalskipTables?: (string | RegExp)[]

      Table names or patterns to skip during schema generation.

Methods

alterTable

  • alterTable(diff, safe): string[]
  • Parameters

    Returns string[]

inheritedalterTableColumn

  • alterTableColumn(column, table, changedProperties): string[]
  • Parameters

    • column: Column
    • table: DatabaseTable
    • changedProperties: Set<string>

    Returns string[]

inheritedalterTableComment

  • alterTableComment(table, comment): string
  • Parameters

    • table: DatabaseTable
    • optionalcomment: string

    Returns string

inheritedappend

  • append(array, sql, pad): void
  • Parameters

    • array: string[]
    • sql: string | string[]
    • pad: boolean = false

    Returns void

inheritedappendComments

  • appendComments(table): string[]
  • Parameters

    • table: DatabaseTable

    Returns string[]

inheritedcastColumn

  • castColumn(name, type): string
  • Parameters

    • name: string
    • type: string

    Returns string

inheritedcreateCheck

  • createCheck(table, check): string
  • Parameters

    • table: DatabaseTable
    • check: CheckDef<unknown>

    Returns string

inheritedcreateForeignKey

  • createForeignKey(table, foreignKey, alterTable, inline): string
  • Parameters

    • table: DatabaseTable
    • foreignKey: ForeignKey
    • alterTable: boolean = true
    • inline: boolean = false

    Returns string

inheritedcreateIndex

  • createIndex(index, table, createPrimary): string
  • Parameters

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

    Returns string

createTable

  • createTable(table, alter): string[]
  • Parameters

    • table: DatabaseTable
    • optionalalter: boolean

    Returns string[]

createTableColumn

  • createTableColumn(column, table, _changedProperties): undefined | string
  • Parameters

    • column: Column
    • table: DatabaseTable
    • optional_changedProperties: Set<string>

    Returns undefined | string

databaseExists

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

    Returns Promise<boolean>

disableForeignKeysSQL

  • disableForeignKeysSQL(): string
  • Returns string

inheriteddropConstraint

  • dropConstraint(table, name): string
  • Parameters

    • table: string
    • name: string

    Returns string

dropForeignKey

  • dropForeignKey(tableName, constraintName): string
  • Parameters

    • tableName: string
    • constraintName: string

    Returns string

dropIndex

  • dropIndex(table, index, oldIndexName): string
  • Parameters

    • table: string
    • index: IndexDef
    • oldIndexName: string = index.keyName

    Returns string

inheriteddropTableIfExists

  • dropTableIfExists(name, schema): string
  • Parameters

    • name: string
    • optionalschema: string

    Returns string

enableForeignKeysSQL

  • enableForeignKeysSQL(): string
  • Returns string

inheritedfinalizeTable

  • finalizeTable(table, charset, collate): string
  • Parameters

    • table: DatabaseTable
    • charset: string
    • optionalcollate: string

    Returns string

getAddColumnsSQL

  • getAddColumnsSQL(table, columns, diff): string[]
  • Parameters

    Returns string[]

inheritedgetAlterNativeEnumSQL

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

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

    Returns string

inheritedgetChangeColumnCommentSQL

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

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

    Returns string

getCreateDatabaseSQL

  • getCreateDatabaseSQL(name): string
  • Parameters

    • name: string

    Returns string

getCreateIndexSQL

  • getCreateIndexSQL(tableName, index): string
  • Parameters

    Returns string

inheritedgetCreateNamespaceSQL

  • getCreateNamespaceSQL(name): string
  • Parameters

    • name: string

    Returns string

inheritedgetCreateNativeEnumSQL

  • getCreateNativeEnumSQL(name, values, schema): string
  • Parameters

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

    Returns string

inheritedgetDatabaseExistsSQL

  • getDatabaseExistsSQL(name): string
  • Parameters

    • name: string

    Returns string

inheritedgetDatabaseNotExistsError

  • getDatabaseNotExistsError(dbName): string
  • Parameters

    • dbName: string

    Returns string

inheritedgetDefaultEmptyString

  • getDefaultEmptyString(): string
  • Returns string

getDropColumnsSQL

  • getDropColumnsSQL(tableName, columns, schemaName): string
  • Parameters

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

    Returns string

getDropDatabaseSQL

  • getDropDatabaseSQL(name): string
  • Parameters

    • name: string

    Returns string

inheritedgetDropIndexSQL

  • getDropIndexSQL(tableName, index): string
  • Parameters

    Returns string

inheritedgetDropNamespaceSQL

  • getDropNamespaceSQL(name): string
  • Parameters

    • name: string

    Returns string

inheritedgetDropNativeEnumSQL

  • getDropNativeEnumSQL(name, schema): string
  • Parameters

    • name: string
    • optionalschema: string

    Returns string

getListTablesSQL

  • getListTablesSQL(): string
  • Returns string

getManagementDbName

  • getManagementDbName(): string
  • Returns string

inheritedgetNamespaces

  • getNamespaces(connection): Promise<string[]>
  • Parameters

    Returns Promise<string[]>

inheritedgetPostAlterTable

  • getPostAlterTable(tableDiff, safe): string[]
  • Parameters

    Returns string[]

inheritedgetPreAlterTable

  • getPreAlterTable(tableDiff, safe): string[]
  • Parameters

    Returns string[]

getPrimaryKeys

  • getPrimaryKeys(connection, indexes, tableName, schemaName): Promise<string[]>
  • Parameters

    Returns Promise<string[]>

inheritedgetReferencedTableName

  • getReferencedTableName(referencedTableName, schema): string
  • Parameters

    • referencedTableName: string
    • optionalschema: string

    Returns string

inheritedgetRenameColumnSQL

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

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

    Returns string

inheritedgetRenameIndexSQL

  • getRenameIndexSQL(tableName, index, oldIndexName): string[]
  • Parameters

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

    Returns string[]

inheritedgetSchemaBeginning

  • getSchemaBeginning(_charset, disableForeignKeys): string
  • Parameters

    • _charset: string
    • optionaldisableForeignKeys: boolean

    Returns string

inheritedgetSchemaEnd

  • getSchemaEnd(disableForeignKeys): string
  • Parameters

    • optionaldisableForeignKeys: boolean

    Returns string

inheritedgetTablesGroupedBySchemas

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

    Returns Map<undefined | string, Table[]>

inheritedhasNonDefaultPrimaryKeyName

  • hasNonDefaultPrimaryKeyName(table): boolean
  • Parameters

    • table: DatabaseTable

    Returns boolean

inheritedinferLengthFromColumnType

  • inferLengthFromColumnType(type): undefined | number
  • Parameters

    • type: string

    Returns undefined | number

isImplicitIndex

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


    Parameters

    • name: string

    Returns boolean

loadInformationSchema

  • loadInformationSchema(schema, connection, tables, schemas): Promise<void>
  • Parameters

    Returns Promise<void>

inheritedmapForeignKeys

  • mapForeignKeys(fks, tableName, schemaName): Dictionary
  • Parameters

    • fks: any[]
    • tableName: string
    • optionalschemaName: string

    Returns Dictionary

inheritednormalizeDefaultValue

  • normalizeDefaultValue(defaultValue, length, defaultValues): string | number
  • Parameters

    Returns string | number

inheritedsplitTableName

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

    • name: string
    • skipDefaultSchema: boolean = false

    Returns [undefined | string, string]

supportsSchemaConstraints

  • supportsSchemaConstraints(): boolean
  • Returns boolean