Skip to main content
Version: 4.4

Interface: SchemaBuilder#

knex.Knex.SchemaBuilder

Hierarchy#

Properties#

[Symbol.toStringTag]#

Readonly [Symbol.toStringTag]: string

Inherited from: ChainableInterface.[Symbol.toStringTag]

Defined in: node_modules/knex/types/index.d.ts:1639

Methods#

alterTable#

alterTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder

Parameters:#

NameType
tableNamestring
callback(tableBuilder: CreateTableBuilder) => any

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1693


asCallback#

asCallback(callback: Function): Promise<void>

Parameters:#

NameType
callbackFunction

Returns: Promise<void>

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1657


catch#

catch<TResult>(onrejected?: null | (reason: any) => TResult | PromiseLike<TResult>): Promise<void | TResult>

Attaches a callback for only the rejection of the Promise.

Type parameters:#

NameDefault
TResultnever

Parameters:#

NameTypeDescription
onrejected?null | (reason: any) => TResult | PromiseLike<TResult>The callback to execute when the Promise is rejected.

Returns: Promise<void | TResult>

A Promise for the completion of the callback.

Inherited from: ChainableInterface

Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1448


connection#

connection(connection: any): SchemaBuilder

Parameters:#

NameType
connectionany

Returns: SchemaBuilder

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1644


createSchema#

createSchema(schemaName: string): SchemaBuilder

Parameters:#

NameType
schemaNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1691


createSchemaIfNotExists#

createSchemaIfNotExists(schemaName: string): SchemaBuilder

Parameters:#

NameType
schemaNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1692


createTable#

createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder

Parameters:#

NameType
tableNamestring
callback(tableBuilder: CreateTableBuilder) => any

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1683


createTableIfNotExists#

createTableIfNotExists(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): SchemaBuilder

Parameters:#

NameType
tableNamestring
callback(tableBuilder: CreateTableBuilder) => any

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1687


debug#

debug(enabled: boolean): SchemaBuilder

Parameters:#

NameType
enabledboolean

Returns: SchemaBuilder

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1645


dropSchema#

dropSchema(schemaName: string): SchemaBuilder

Parameters:#

NameType
schemaNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1706


dropSchemaIfExists#

dropSchemaIfExists(schemaName: string): SchemaBuilder

Parameters:#

NameType
schemaNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1707


dropTable#

dropTable(tableName: string): SchemaBuilder

Parameters:#

NameType
tableNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1698


dropTableIfExists#

dropTableIfExists(tableName: string): SchemaBuilder

Parameters:#

NameType
tableNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1705


finally#

finally(onfinally?: null | () => void): Promise<void>

Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

Parameters:#

NameTypeDescription
onfinally?null | () => voidThe callback to execute when the Promise is settled (fulfilled or rejected).

Returns: Promise<void>

A Promise for the completion of the callback.

Inherited from: ChainableInterface

Defined in: docs/node_modules/typescript/lib/lib.es2018.promise.d.ts:31


hasColumn#

hasColumn(tableName: string, columnName: string): Promise<boolean>

Parameters:#

NameType
tableNamestring
columnNamestring

Returns: Promise<boolean>

Defined in: node_modules/knex/types/index.d.ts:1700


hasTable#

hasTable(tableName: string): Promise<boolean>

Parameters:#

NameType
tableNamestring

Returns: Promise<boolean>

Defined in: node_modules/knex/types/index.d.ts:1699


options#

options(options: Readonly<{ [key: string]: any; }>): SchemaBuilder

Parameters:#

NameType
optionsReadonly<{ [key: string]: any; }>

Returns: SchemaBuilder

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1643


pipe#

pipe<T>(writable: T, options?: Readonly<{ [key: string]: any; }>): PassThrough

Type parameters:#

NameType
TWritableStream<T>

Parameters:#

NameType
writableT
options?Readonly<{ [key: string]: any; }>

Returns: PassThrough

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1653


queryContext#

queryContext(context: any): SchemaBuilder

Parameters:#

NameType
contextany

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1710


raw#

raw(statement: string): SchemaBuilder

Parameters:#

NameType
statementstring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1708


renameTable#

renameTable(oldTableName: string, newTableName: string): Promise<void>

Parameters:#

NameType
oldTableNamestring
newTableNamestring

Returns: Promise<void>

Defined in: node_modules/knex/types/index.d.ts:1697


stream#

stream(handler: (readable: PassThrough) => any): Promise<any>

Parameters:#

NameType
handler(readable: PassThrough) => any

Returns: Promise<any>

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1647

stream(options: Readonly<{ [key: string]: any; }>, handler: (readable: PassThrough) => any): Promise<any>

Parameters:#

NameType
optionsReadonly<{ [key: string]: any; }>
handler(readable: PassThrough) => any

Returns: Promise<any>

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1648

stream(options?: Readonly<{ [key: string]: any; }>): PassThrough

Parameters:#

NameType
options?Readonly<{ [key: string]: any; }>

Returns: PassThrough

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1652


table#

table(tableName: string, callback: (tableBuilder: AlterTableBuilder) => any): Promise<void>

Parameters:#

NameType
tableNamestring
callback(tableBuilder: AlterTableBuilder) => any

Returns: Promise<void>

Defined in: node_modules/knex/types/index.d.ts:1701


then#

then<TResult1, TResult2>(onfulfilled?: null | (value: void) => TResult1 | PromiseLike<TResult1>, onrejected?: null | (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>

Attaches callbacks for the resolution and/or rejection of the Promise.

Type parameters:#

NameDefault
TResult1void
TResult2never

Parameters:#

NameTypeDescription
onfulfilled?null | (value: void) => TResult1 | PromiseLike<TResult1>The callback to execute when the Promise is resolved.
onrejected?null | (reason: any) => TResult2 | PromiseLike<TResult2>The callback to execute when the Promise is rejected.

Returns: Promise<TResult1 | TResult2>

A Promise for the completion of which ever callback is executed.

Inherited from: ChainableInterface

Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1441


toQuery#

toQuery(): string

Returns: string

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1642


toSQL#

toSQL(): Sql

Returns: Sql

Defined in: node_modules/knex/types/index.d.ts:1712


toString#

toString(): string

Returns: string

Defined in: node_modules/knex/types/index.d.ts:1711


transacting#

transacting(trx: Transaction<any, any>): SchemaBuilder

Parameters:#

NameType
trxTransaction<any, any>

Returns: SchemaBuilder

Inherited from: ChainableInterface

Defined in: node_modules/knex/types/index.d.ts:1646


withSchema#

withSchema(schemaName: string): SchemaBuilder

Parameters:#

NameType
schemaNamestring

Returns: SchemaBuilder

Defined in: node_modules/knex/types/index.d.ts:1709

Last updated on by Martin Adámek