How to contribute to Knex.js
Make changes in the
/srcdirectory and run
npm run babel(runs once and then quits) or
npm run dev(runs once and then watches for changes) to update the files in
npm testwill also do this.
Before sending a pull request for a feature or bug fix, be sure to have tests.
Use the same coding style as the rest of the codebase.
All pull requests should be made to the
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.
The Easy Way
By default, Knex runs tests against MySQL (using mysql and mysql2), Postgres, and SQLite. The easiest way to run the tests is by creating the database
'knex_test' and granting permissions to the database's default username:
- MySQL: root
- Postgres: postgres
No setup is required for SQLite.
You can optionally specify which dialects to test using the
DB environment variable. Values should be space separated and can include:
$ DB='postgres mysql' npm test
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 using the
KNEX_TEST environment variable.
$ KNEX_TEST='./path/to/my/config.js' npm test
Creating Postgres User
Depending on your setup you might not have the default postgres user. To create a new user, login to Postgres and use the following queries to add the user. This assumes you've already created the
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
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.