This commit is contained in:
Tutur33
2023-11-24 23:58:26 +01:00
parent 25395c0ee1
commit 938ad9d309
4191 changed files with 41 additions and 518781 deletions
-2341
View File
File diff suppressed because it is too large Load Diff
-194
View File
@@ -1,194 +0,0 @@
## How to contribute to Knex.js
- Make changes in the `/lib` directory.
- Before sending a pull request for a feature or bug fix, be sure to have
[tests](https://github.com/knex/knex/tree/master/test). Every pull request that changes the queries should have
also **integration tests which are ran against real database** (in addition to unit tests which checks which kind of queries
are being created).
- Use the same coding style as the rest of the
[codebase](https://github.com/knex/knex/blob/master/knex.js).
- All pull requests should be made to the `master` branch.
- Pull request description should have link to corresponding PR of documentation branch.
- All pull requests that modify the public API should be updated in [types/index.d.ts](https://github.com/knex/knex/blob/master/types/index.d.ts)
## Documentation
Documentation is no longer maintained in knex master repository. All the documentation pull requests should be sent to https://github.com/knex/documentation
Documentation pull requests should not be merged before knex version which has the new documented feature is released.
## I would like to add support for new dialect to knex, is it possible?
Currently there are already way too many dialects supported in `knex` and instead of adding new dialect to central codebase, all the dialects should be moved to separate npm packages out from `knex` core library with their respective maintainers and test suites.
So if you like to write your own dialect, you can just inherit own dialect from knex base classes and use it by passing dialect to knex in knex configuration (https://runkit.com/embed/90b3cpyr4jh2):
```js
// simple dialect overriding sqlite3 dialect to use sqlite3-offline driver
require('sqlite3-offline');
const Knex = require('knex');
const Dialect = require(`knex/lib/dialects/sqlite3/index.js`);
Dialect.prototype._driver = () => require('sqlite3-offline');
const knex = Knex({
client: Dialect,
connection: ':memory:',
});
console.log(knex.select(knex.raw(1)).toSQL());
await knex.schema.createTable('fooobar', (t) => {
t.bigincrements('id');
t.string('data');
});
await knex('fooobar').insert({ data: 'nomnom' });
console.log('Gimme all the data:', await knex('fooobar'));
```
## What is minimal code to reproduce bug and why I have to provide that when I can just tell whats the problem is
Writing minimal reproduction code for the problem is time-consuming and sometimes it is also really hard, for
example when the original code where the bug happens is written using express or mocha. So why is it necessary
for me to commit so much time to it when the problem is in `knex`? Contributors should be grateful that I reported
the bug I found.
The point of runnable code to reproduce the problem is to easily verify that there really is a problem and that the one
who did the report did nothing wrong (surprisingly often problem is in the user code). So instead of just description
what to do the complete code encourages devs to actually test out that problem exists and start solving it and it
saves lots of time.
tl;dr list:
1. Actually in most of the cases developer already figures out what was the problem when writing the minimal test case
or if there was problem how stuff was initialized or how async code was written it is easy to point out the problem.
2. It motivates developer to actually try out if the bug really exist by not having to figure out from incomplete example
environment in which and how bug actually manifests.
3. There are currently very few people fixing knex issues and if one has to put easily 15-30 minutes time to issue just
to see that I cannot reproduce this issue it just wastes development hours that were available for improving knex.
Test case should initialize needed tables, insert needed data and fail...
```js
const knex = require('knex')({
client: 'pg',
connection: 'postgres:///knex_test'
});
async function main() {
await knex.schema.createTable(...);
await knex('table').insert({foo: 'bar}');
await knex.destroy();
}
main();
```
Usually issues without reproduction code available are just closed and if the same issue is reported multiple
times maybe someone looks into it.
One easy way to setup database for your reproduction is to use database from knex's docker-compose setup (npm run db:start) and by checking the connection settings from tests' `test/knexfile.js`.
## Integration Tests
### The Easy Way
By default, Knex runs tests against sqlite3, postgresql, mysql, mysql2, mssql and oracledb drivers. All databases can be initialized and ran with docker.
Docker databases can be started and initialized with:
```bash
npm run db:start
```
and stopped with:
```bash
npm run db:stop
```
In case you don't need all of the databases, you can use simplified dev Docker configuration that only runs PostgreSQL, by running `npm run db:start:postgres` and `npm run db:stop:postgres` accordingly.
### Installing support for oracledb
Oracle has started providing precompiled driver libs for all the platforms, which makes it viable to run oracle tests also locally against oracledb running in docker.
Check message when running
```bash
npm install oracledb
```
and download driver library binary packages and unzip it to ~/lib directory.
### Specifying Databases
You can optionally specify which dialects to test using the `DB` environment variable. Values should be space separated and can include:
- mysql
- mysql2
- postgres
- sqlite3
- oracledb
- mssql
```bash
$ DB='postgres mysql' npm test
```
### Custom Configuration
If you'd like to override the database configuration (to use a different host, for example), you can override the path to the [default test configuration](https://github.com/knex/knex/blob/master/test/knexfile.js) using the `KNEX_TEST` environment variable.
```bash
$ KNEX_TEST='./path/to/my/config.js' npm test
```
### Creating Postgres User
If you are running tests against own local database one might need to setup test user and database for knex to connect.
To create a new user, login to Postgres and use the following queries to add the user. This assumes you've already created the `knex_test` database.
```
CREATE ROLE postgres WITH LOGIN PASSWORD '';
GRANT ALL PRIVILEGES ON DATABASE "knex_test" TO postgres;
```
Once this is done, check it works by attempting to login:
```
psql -h localhost -U postgres -d knex_test
```
## Typescript source files
> TL;DR: Starting with release 2.0.0 Knex is adding support for Typescript source files. Thus to develop in this repo you will need to run `npm run build` each time you edit `.ts` files to generate the resulting `.js` files. This is automatically run whenever you run `npm install` or checkout a new Git branch so when developing in Javascript you don't have to worry about it. It is encouraged that new functionality and sources be written in Typescript but this is not required.
Starting with release 2.0.0, Knex is support source additions in Typescript! This allows for better safety in the code added. However, pre-2.0.0 Knex was always written in pure Javascript and thus a "hybrid" approach is being used for 2.0.0 to allow for the new `.ts` files to exist along `.js` files that make up the majority of this repository.
To develop in this repository use the `npm run build` and `npm run clean` commands to compile and delete the `.js` and related files from `.ts` files. If you wish to have the `tsc` compiled watch and recompile on changes then run `npm run build:ts -- --watch`. Note that for easy integration with Javascript the outputted files are done in a "side-by-side" manner meaning that `lib/foo/bar.ts` will result in `lib/foo/bar.js`. This is done automatically via the npm script command `"prepare"` whenever you run `npm install` and Git hook for `post-checkout` (added by Husky) which executes when you run commands like `git checkout` , thus making it easier to not have to worry about this if you're working in pure Javascript.
The script file `./scripts/update_gitignore_for_tsc_output.js` file is called as part of the `npm run build` command which will update the `lib/.gitignore` file which is used to ensure generated `.js` and related files from `tsc` compilation are not checked into the git repo.
## Want to be Collaborator?
There is always room for more collaborators. Be active on resolving github issues / sending pull requests / reviewing code and we will ask you to join.
### Etiquette (/ˈɛtᵻkɛt/ or /ˈɛtᵻkɪt/, French: [e.ti.kɛt])
Make pull requests for your changes, do not commit directly to master (release stuff like fixing changelog are ok though).
All the pull requests must be peer reviewed by other collaborator, so don't merge your request before that. If there is no response ping others.
If you are going to add new feature to knex (not just a bugfix) it should be discussed first with others to agree on details.
Join Gitter chat if you feel to chat outside of github issues.
-22
View File
@@ -1,22 +0,0 @@
Copyright (c) 2013-present Tim Griesser
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
-149
View File
@@ -1,149 +0,0 @@
# [knex.js](https://knex.github.io/documentation/)
[![npm version](http://img.shields.io/npm/v/knex.svg)](https://npmjs.org/package/knex)
[![npm downloads](https://img.shields.io/npm/dm/knex.svg)](https://npmjs.org/package/knex)
![](https://github.com/knex/knex/workflows/CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/knex/knex/badge.svg?branch=master)](https://coveralls.io/r/knex/knex?branch=master)
[![Dependencies Status](https://img.shields.io/librariesio/github/knex/knex)](https://libraries.io/npm/knex)
[![Gitter chat](https://badges.gitter.im/tgriesser/knex.svg)](https://gitter.im/tgriesser/knex)
> **A SQL query builder that is _flexible_, _portable_, and _fun_ to use!**
A batteries-included, multi-dialect (PostgreSQL, MySQL, CockroachDB, MSSQL, SQLite3, Oracle (including Oracle Wallet Authentication)) query builder for
Node.js, featuring:
- [transactions](https://knex.github.io/documentation/#Transactions)
- [connection pooling](https://knex.github.io/documentation/#Installation-pooling)
- [streaming queries](https://knex.github.io/documentation/#Interfaces-Streams)
- both a [promise](https://knex.github.io/documentation/#Interfaces-Promises) and [callback](https://knex.github.io/documentation/#Interfaces-Callbacks) API
- a [thorough test suite](https://github.com/knex/knex/actions)
Node.js versions 12+ are supported.
- Take a look at the [full documentation](https://knex.github.io/documentation) to get started!
- Browse the [list of plugins and tools](https://github.com/knex/knex/blob/master/ECOSYSTEM.md) built for knex
- Check out our [recipes wiki](https://github.com/knex/knex/wiki/Recipes) to search for solutions to some specific problems
- In case of upgrading from an older version, see [migration guide](https://github.com/knex/knex/blob/master/UPGRADING.md)
You can report bugs and discuss features on the [GitHub issues page](https://github.com/knex/knex/issues) or send tweets to [@kibertoad](http://twitter.com/kibertoad).
For support and questions, join our [Gitter channel](https://gitter.im/tgriesser/knex).
For knex-based Object Relational Mapper, see:
- https://github.com/Vincit/objection.js
- https://github.com/mikro-orm/mikro-orm
- https://bookshelfjs.org
To see the SQL that Knex will generate for a given query, you can use [Knex Query Lab](https://michaelavila.com/knex-querylab/)
## Examples
We have several examples [on the website](http://knexjs.org). Here is the first one to get you started:
```js
const knex = require('knex')({
client: 'sqlite3',
connection: {
filename: './data.db',
},
});
try {
// Create a table
await knex.schema
.createTable('users', (table) => {
table.increments('id');
table.string('user_name');
})
// ...and another
.createTable('accounts', (table) => {
table.increments('id');
table.string('account_name');
table.integer('user_id').unsigned().references('users.id');
});
// Then query the table...
const insertedRows = await knex('users').insert({ user_name: 'Tim' });
// ...and using the insert id, insert into the other table.
await knex('accounts').insert({
account_name: 'knex',
user_id: insertedRows[0],
});
// Query both of the rows.
const selectedRows = await knex('users')
.join('accounts', 'users.id', 'accounts.user_id')
.select('users.user_name as user', 'accounts.account_name as account');
// map over the results
const enrichedRows = selectedRows.map((row) => ({ ...row, active: true }));
// Finally, add a catch statement
} catch (e) {
console.error(e);
}
```
## TypeScript example
```ts
import { Knex, knex } from 'knex';
interface User {
id: number;
age: number;
name: string;
active: boolean;
departmentId: number;
}
const config: Knex.Config = {
client: 'sqlite3',
connection: {
filename: './data.db',
},
};
const knexInstance = knex(config);
try {
const users = await knex<User>('users').select('id', 'age');
} catch (err) {
// error handling
}
```
## Usage as ESM module
If you are launching your Node application with `--experimental-modules`, `knex.mjs` should be picked up automatically and named ESM import should work out-of-the-box.
Otherwise, if you want to use named imports, you'll have to import knex like this:
```js
import { knex } from 'knex/knex.mjs';
```
You can also just do the default import:
```js
import knex from 'knex';
```
If you are not using TypeScript and would like the IntelliSense of your IDE to work correctly, it is recommended to set the type explicitly:
```js
/**
* @type {Knex}
*/
const database = knex({
client: 'mysql',
connection: {
host: '127.0.0.1',
user: 'your_database_user',
password: 'your_database_password',
database: 'myapp_test',
},
});
database.migrate.latest();
```
-245
View File
@@ -1,245 +0,0 @@
## Upgrading to new knex.js versions
### Upgrading to version 2.0.0+
- Since `sqlite3` is maintained again, we switched back to it. If you are using `@vscode/sqlite3` driver dependency, please replace it with `sqlite3` in your `package.json`;
### Upgrading to version 1.0.0+
- Node.js older than 12 is no longer supported, make sure to update your environment;
- If you are using `sqlite3` driver dependency, please replace it with `@vscode/sqlite3` in your `package.json`;
- `RETURNING` operations now always return an object with column names;
- Migrator now returns list of migrations as objects.
### Upgrading to version 0.95.0+
- TypeScript type exports changed significantly. While `import Knex from 'knex';` used to import the knex instantiation function, the namespace and the interface for the knex instantiation function/object, there is now a clear distinction between them:
```typescript
import { knex } from 'knex'; // this is a function that you call to instantiate knex
import { Knex } from 'knex'; // this is a namespace, and a type of a knex object
import KnexTimeoutError = Knex.KnexTimeoutError; // this is a class from the Knex namespace
const config: Knex.Config = {}; // this is a type from the Knex namespace
const knexInstance: Knex = knex(config);
```
If your code looked like this:
```typescript
import knex from 'knex';
const config: knex.Config = {}; // this is a type from the Knex namespace
const knexInstance = knex(config);
```
Change it to
```typescript
import { knex, Knex } from 'knex';
const config: Knex.Config = {}; // this is a type from the Knex namespace
const knexInstance = knex(config);
```
- If you were importing types such as `Config` or `QueryBuilder` directly, use `Knex` namespace instead.
So change this:
```ts
import { QueryBuilder } from 'knex';
const qb: QueryBuilder = knex('table').select('*');
```
to this:
```ts
import { Knex } from 'knex';
const qb: Knex.QueryBuilder = knex('table').select('*');
```
- IDE autocomplete may stop working if you are using JavaScript (not TypeScript). There are reports for autocomplete still working correctly if knex is used this way:
```js
const knex = require('knex').knex({
//connection parameters
});
```
It also works when using ESM imports:
```js
import { knex } from 'knex';
const kn = knex({
//connection parameters
});
```
For usage as param it can be addressed like this:
```js
/**
* @param {import("knex").Knex} db
*/
function up(db) {
// Your code
}
```
- Syntax for QueryBuilder augmentation changed. Previously it looked like this:
```ts
declare module 'knex' {
interface QueryBuilder {
paginate<TResult = any[]>(
params: IPaginateParams
): KnexQB<any, IWithPagination<TResult>>;
}
}
```
This should be changed into this:
```ts
declare module 'knex' {
namespace Knex {
interface QueryBuilder {
paginate<TResult = any[]>(
params: IPaginateParams
): KnexQB<any, IWithPagination<TResult>>;
}
}
}
```
- TypeScript version 4.1+ is needed when using knex types now.
- MSSQL driver was completely reworked in order to address the multitude of connection pool, error handling and performance issues. Since the new implementation uses `tedious` library directly instead of `mssql`, please replace `mssql` with `tedious` in your dependencies if you are using a MSSQL database.
- Transaction rollback does not trigger a promise rejection for transactions with specified handler. If you want to preserve previous behavior, pass `config` object with `doNotRejectOnRollback: false`:
```js
await knex.transaction(
async (trx) => {
const ids = await trx('catalogues').insert({ name: 'Old Books' }, 'id');
},
{ doNotRejectOnRollback: false }
);
```
- Connection url parsing changed from legacy [url.parse](https://nodejs.org/docs/latest-v10.x/api/url.html#url_legacy_url_api) to [WHATWG URL](https://nodejs.org/docs/latest-v10.x/api/url.html#url_the_whatwg_url_api). If you have symbols, unusual for a URL (not A-z, not digits, not dot, not dash) - check [Node.js docs](https://nodejs.org/docs/latest-v10.x/api/url.html#url_percent_encoding_in_urls) for details
- Global static `Knex.raw` support dropped, use instance `knex.raw` instead. (`require('knex').raw()` won't work anymore)
- v8 flags are no longer supported in cli. To pass these flags use [`NODE_OPTIONS` environment variable](https://nodejs.org/api/cli.html#cli_node_options_options).
For example `NODE_OPTIONS="--max-old-space-size=1536" npm run knex`
- Clients are now classes instead of new-able functions. Please migrate your custom clients to classes.
```js
const Client = require('knex');
const { inherits } = require('util');
// old
function CustomClient(config) {
Client.call(this, config);
// construction logic
}
inherits(CustomClient, Client);
CustomClient.prototype.methodOverride = function () {
// logic
};
// new
class CustomClient extends Client {
// node 12+
driverName = 'abcd';
constructor(config) {
super(config);
this.driverName = 'abcd'; // bad way, will not work
// construction logic
}
methodOverride() {
// logic
}
}
// alternative to declare driverName
CustomClient.prototype.driverName = 'abcd';
```
- There was a major internal restructuring and renaming effort. Most dialect-specific compilers/builder have dialect name as a prefix now. Also some files were moved. Make sure to make adjustments accordingly if you were referencing specific knex library files directly from your code.
- "first" and "pluck" can no longer be both chained on the same operation. Previously only the last one chained was used, now this would throw an error.
- Trying to execute an operation resulting in an empty query such as inserting an empty array, will now throw an error on all database drivers.
### Upgrading to version 0.21.0+
- Node.js older than 10 is no longer supported, make sure to update your environment;
### Upgrading to version 0.19.0+
- Passing unknown properties to connection pool configuration now throws errors (see https://github.com/Vincit/tarn.js/issues/19 for details);
- `beforeDestroy` pool configuration option was removed. You should use tarn.js event handlers if you still need similar functionality.
### Upgrading to version 0.18.0+
- Node.js older than 8 is no longer supported, make sure to update your environment;
- Knex returns native promises instead of bluebird ones now. You will need to update your code not to rely on bluebird-specific functionality;
- Knex.Promise was removed, use native promises;
- Promise is no longer passed to migrations and seeds, use native one;
- If you are using TypeScript, make sure to include 'es6' in compilerOptions.lib, otherwise you may get errors for methods `.catch()` and `then()` not being recognized.
### Upgrading to version 0.17.0+
- Generic support was implemented for TypeScript bindings, which may break TS builds in some edge cases. Please refer to https://knexjs.org/#typescript-support for more elaborate documentation.
### Upgrading to version 0.16.0+
- MSSQL: DB versions older than 2008 are no longer supported, make sure to update your DB;
- PostgreSQL|MySQL: it is recommended to use options object for `table.datetime` and `table.timestamp` methods instead of argument options. See documentation for these methods for more details;
- Node 6: There are known issues with duplicate event listeners when using knex.js with Node.js 6 (resulting in MaxListenersExceededWarning under certain use-cases (such as reusing single knex instance to run migrations or seeds multiple times)). Please upgrade to Node.js 8+ as soon as possible (knex 0.17.0 will be dropping Node.js 6 support altogether);
### Upgrading to version 0.15.0+
- Node.js older than 6 is no longer supported, make sure to update your environment;
- MSSQL: Creating a unique index on the table targeted by stored procedures that were created with QUOTED_IDENTIFIER = OFF fails.
You can use this query to identify all affected stored procedures:
```
SELECT name = OBJECT_NAME([object_id]), uses_quoted_identifier
FROM sys.sql_modules
WHERE uses_quoted_identifier = 0;
```
The only known solution is to recreate all stored procedures with QUOTED_IDENTIFIER = OFF
- MariaDB: `mariadb` dialect is no longer supported;
Instead, use "mysql" or "mysql2" dialects.
### Upgrading to version 0.14.4+
- Including schema in tableName parameter in migrations no longer works, so this is invalid:
```js
await knex.migrate.latest({
directory: 'src/services/orders/database/migrations',
tableName: 'orders.orders_migrations',
});
```
Instead, starting from 0.14.5 you should use new parameter schemaName:
```js
await knex.migrate.latest({
directory: 'src/services/orders/database/migrations',
tableName: 'orders_migrations',
schemaName: 'orders',
});
```
-23
View File
@@ -1,23 +0,0 @@
// Knex.js
// --------------
// (c) 2013-present Tim Griesser
// Knex may be freely distributed under the MIT license.
// For details and documentation:
// http://knexjs.org
const knex = require('./lib/index');
/**
* These export configurations enable JS and TS developers
* to consume knex in whatever way best suits their needs.
* Some examples of supported import syntax includes:
* - `const knex = require('knex')`
* - `const { knex } = require('knex')`
* - `import * as knex from 'knex'`
* - `import { knex } from 'knex'`
* - `import knex from 'knex'`
*/
knex.knex = knex;
knex.default = knex;
module.exports = knex;
-11
View File
@@ -1,11 +0,0 @@
// Knex.js
// --------------
// (c) 2013-present Tim Griesser
// Knex may be freely distributed under the MIT license.
// For details and documentation:
// http://knexjs.org
import knex from './lib/index.js';
export { knex };
export default knex;
-268
View File
@@ -1,268 +0,0 @@
{
"name": "knex",
"version": "2.5.1",
"description": "A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3",
"main": "knex",
"types": "types/index.d.ts",
"engines": {
"node": ">=12"
},
"scripts": {
"build": "npm run build:gitignore && npm run build:ts && npm run format",
"clean": "node scripts/clean.js",
"build:ts": "tsc",
"build:gitignore": "node scripts/update_gitignore_for_tsc_output.js run",
"format": "prettier --write --list-different .",
"format:check": "prettier --list-different .",
"debug:test": "mocha --inspect-brk --exit -t 0 test/all-tests-suite.js",
"debug:tape": "node --inspect-brk test/tape/index.js",
"coveralls": "nyc report --reporter=lcov",
"lint": "eslint --cache \"**/*.js\"",
"lint:fix": "eslint --cache --fix \"**/*.js\"",
"lint:types": "tsd && dtslint types",
"lint:everything": "npm run lint && npm run lint:types",
"lint:fix:everything": "npm run lint:fix && npm run lint:types",
"test:unit": "npm run test:unit-only && npm run test:cli",
"test:unit-only": "mocha --exit -t 10000 --config test/mocha-unit-config-test.js",
"test:db": "mocha --exit -t 10000 --config test/mocha-integration-config-test.js",
"test:db:coverage": "nyc mocha --exit --check-leaks -t 10000 --config test/mocha-integration-config-test.js && npm run test:tape",
"test:db:no-oracle": "cross-env DB=\"mssql mysql mysql2 postgres sqlite3\" mocha --exit -t 10000 --config test/mocha-integration-config-test.js && npm run test:tape",
"test": "mocha --exit -t 10000 --config test/mocha-all-config-test.js && npm run test:tape && npm run test:cli",
"test:coverage": "nyc mocha --exit --check-leaks -t 10000 --config test/mocha-all-config-test.js && npm run test:tape && npm run test:cli",
"test:everything": "npm run lint:everything && npm run test:coverage",
"test:mssql": "cross-env DB=mssql npm run test:db",
"test:mysql": "cross-env DB=mysql npm run test:db",
"test:mysql2": "cross-env DB=mysql2 npm run test:db",
"test:oracledb": "cross-env DB=oracledb npm run test:db",
"test:sqlite": "cross-env DB=sqlite3 npm run test:db",
"test:better-sqlite3": "cross-env DB=better-sqlite3 npm run test:db",
"test:postgres": "cross-env DB=postgres npm run test:db",
"test:cockroachdb": "cross-env DB=cockroachdb npm run test:db",
"test:pgnative": "cross-env DB=pgnative npm run test:db",
"test:tape": "node test/tape/index.js | tap-spec",
"test:cli": "cross-env KNEX_PATH=../knex.js KNEX=bin/cli.js jake -f test/jake/Jakefile",
"db:start": "docker-compose -f scripts/docker-compose.yml up --build -d mysql oracledb postgres mssql cockroachdb pgnative && docker-compose -f scripts/docker-compose.yml up waitmssql waitmysql waitpostgres waitoracledb",
"db:start:no-oracle": "docker-compose -f scripts/docker-compose.yml up --build -d mysql postgres mssql cockroachdb pgnative && docker-compose -f scripts/docker-compose.yml up waitmssql waitmysql waitpostgres",
"db:stop": "docker-compose -f scripts/docker-compose.yml down",
"db:start:postgres": "docker-compose -f scripts/docker-compose.yml up --build -d postgres && docker-compose -f scripts/docker-compose.yml up waitpostgres",
"db:stop:postgres": "docker-compose -f scripts/docker-compose.yml down",
"db:start:pgnative": "docker-compose -f scripts/docker-compose.yml up --build -d pgnative && docker-compose -f scripts/docker-compose.yml up waitpgnative",
"db:stop:pgnative": "docker-compose -f scripts/docker-compose.yml down",
"db:start:mysql": "docker-compose -f scripts/docker-compose.yml up --build -d mysql && docker-compose -f scripts/docker-compose.yml up waitmysql",
"db:stop:mysql": "docker-compose -f scripts/docker-compose.yml down",
"db:start:mssql": "docker-compose -f scripts/docker-compose.yml up --build -d mssql && docker-compose -f scripts/docker-compose.yml up waitmssql",
"db:stop:mssql": "docker-compose -f scripts/docker-compose.yml down",
"db:start:cockroachdb": "docker-compose -f scripts/docker-compose.yml up --build -d cockroachdb && docker-compose -f scripts/docker-compose.yml up waitcockroachdb",
"db:stop:cockroachdb": "docker-compose -f scripts/docker-compose.yml down",
"db:start:oracle": "docker-compose -f scripts/docker-compose.yml up --build -d oracledb && docker-compose -f scripts/docker-compose.yml up waitoracledb",
"db:stop:oracle": "docker-compose -f scripts/docker-compose.yml down",
"stress:init": "docker-compose -f scripts/stress-test/docker-compose.yml up --no-start && docker-compose -f scripts/stress-test/docker-compose.yml start",
"stress:test": "node scripts/stress-test/knex-stress-test.js | grep -A 5 -B 60 -- '- STATS '",
"stress:destroy": "docker-compose -f scripts/stress-test/docker-compose.yml stop",
"prepare": "husky install && npm run clean && npm run build",
"prepublishOnly": "npm run format:check && npm run lint:everything && npm run clean && npm run build"
},
"dependencies": {
"colorette": "2.0.19",
"commander": "^10.0.0",
"debug": "4.3.4",
"escalade": "^3.1.1",
"esm": "^3.2.25",
"get-package-type": "^0.1.0",
"getopts": "2.3.0",
"interpret": "^2.2.0",
"lodash": "^4.17.21",
"pg-connection-string": "2.6.1",
"rechoir": "^0.8.0",
"resolve-from": "^5.0.0",
"tarn": "^3.0.2",
"tildify": "2.0.0"
},
"peerDependenciesMeta": {
"tedious": {
"optional": true
},
"mysql": {
"optional": true
},
"mysql2": {
"optional": true
},
"pg": {
"optional": true
},
"pg-native": {
"optional": true
},
"sqlite3": {
"optional": true
},
"better-sqlite3": {
"optional": true
}
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
"*.js": "eslint --cache --fix"
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.1",
"@types/node": "^20.4.0",
"better-sqlite3": "^7.6.2",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"chai-subset-in-order": "^3.1.0",
"cli-testlab": "^2.2.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"dtslint": "4.2.1",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.1",
"jake": "^10.8.5",
"JSONStream": "^1.3.5",
"lint-staged": "^13.0.0",
"mocha": "^10.0.0",
"mock-fs": "^5.1.4",
"mysql": "^2.18.1",
"mysql2": "^3.2.0",
"nyc": "^15.1.0",
"oracledb": "^5.4.0",
"pg": "^8.8.0",
"pg-query-stream": "^4.2.4",
"prettier": "2.8.7",
"rimraf": "^3.0.2",
"sinon": "^15.0.1",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"sqlite3": "^5.0.11",
"tap-spec": "^5.0.0",
"tape": "^5.6.0",
"tedious": "^14.4.0",
"toxiproxy-node-client": "^2.0.6",
"ts-node": "^10.9.1",
"tsd": "^0.28.1",
"typescript": "5.0.4"
},
"buildDependencies": [
"rimraf"
],
"bin": {
"knex": "./bin/cli.js"
},
"repository": {
"type": "git",
"url": "git://github.com/knex/knex.git"
},
"homepage": "https://knex.github.io/documentation/",
"keywords": [
"sql",
"query",
"postgresql",
"postgres",
"mysql",
"cockroachdb",
"sqlite3",
"oracle",
"mssql",
"builder",
"querybuilder",
"build",
"db",
"database"
],
"author": {
"name": "Tim Griesser",
"web": "https://github.com/tgriesser"
},
"contributors": [
{
"name": "Mikael Lepisto"
},
{
"name": "Igor Savin",
"web": "https://www.codeflashbacks.com"
},
{
"name": "Olivier Cavadenti"
},
{
"name": "Simon Liden"
},
{
"name": "Paul Gaurab",
"web": "https://lorefnon.tech"
},
{
"name": "Brian Lauber",
"web": "https://briandamaged.org"
}
],
"browser": {
"./lib/migrations/migrate/Migrator.js": "./lib/util/noop.js",
"./lib/bin/cli.js": "./lib/util/noop.js",
"./lib/migrations/seed/Seeder.js": "./lib/util/noop.js",
"tedious": false,
"mysql": false,
"mysql2": false,
"pg": false,
"pg-native": false,
"pg-query-stream": false,
"oracle": false,
"sqlite3": false,
"better-sqlite3": false,
"oracledb": false
},
"react-native": {
"./lib/migrate": "./lib/util/noop.js",
"./lib/seed": "./lib/util/noop.js"
},
"files": [
"bin/*",
"lib/",
"lib/**/*.js",
"!lib/**/*.ts",
"!lib/**/*.d.ts",
"!lib/**/*.js.map",
"!lib/.gitignore",
"scripts/*",
"types/index.d.ts",
"types/result.d.ts",
"types/tables.d.ts",
"CHANGELOG.md",
"CONTRIBUTING.md",
"knex.js",
"knex.mjs",
"LICENSE",
"README.md",
"UPGRADING.md"
],
"license": "MIT",
"tonicExampleFilename": "scripts/runkit-example.js",
"nyc": {
"check-coverage": true,
"lines": 84,
"statements": 82,
"functions": 83,
"branches": 69,
"extension": [
".js"
],
"exclude": [
"lib/dialects/oracle",
"lib/dialects/oracledb",
"test/**/*.spec.js"
]
},
"tsd": {
"directory": "test-tsd",
"compilerOptions": {
"esModuleInterop": false,
"module": "commonjs",
"target": "ES2017"
}
}
}