网页
综合
更新时间 2026-06-26 14:59:48
Schema Builder | Knex.js
自动蜘蛛
knexjs.org
正文约 1808 字
acquireConnectionTimeout
defaultDateTimePrecision
only (knex/from option) PG only
withRecursive MYCRRS
withMaterialized PG+SQ only
withNotMaterialized PG+SQ only
forUpdate PG+MY only
forNoKeyUpdate PG only
skipLocked PG+MY only
hintComment MY+OR only
Extending Query Builder
whereJsonSupersetOf SQMSORRS
whereJsonSubsetOf SQMSORRS
crossJoin conditions MY+SQ only
createViewOrReplace ~SQ
createMaterializedView MYSQMS
refreshMaterializedView MYSQMS
dropMaterializedView MYSQMS
dropMaterializedViewIfExists MYSQMS
createSchema PG only
createSchemaIfNotExists PG only
dropSchemaIfExists PG only
localCheckOption SQMSORCR
cascadedCheckOption SQMSORCR
Named bindings with array values
Environment configuration
Custom migration name
Generated migration extension
Knexfile in other languages
Transactions in migrations
Webpack migration source example
ECMAScript modules (ESM) Interoperability
The knex.schema is a getter function, which returns a stateful object containing the query. Therefore be sure to obtain a new instance of the knex.schema for every query. These methods return promises.
Dialect badges: [-SQ] = not supported by SQLite. [~SQ] = emulated in SQLite (multiple statements/workarounds).
knex.schema.withSchema([schemaName])
Specifies the schema to be used when using the schema-building commands.
knex.schema.createTable(tableName, callback)
Creates a new table on the database, with a callback function to modify the table's structure, using the schema-building commands.
knex.schema.createTableLike(tableName, tableNameToCopy, [callback])
Creates a new table on the database based on another table. Copy only the structure : columns, keys and indexes (expected on SQL Server which only copy columns) and not the data. Callback function can be specified to add columns in the duplicated table.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。