Please note! The github issue tracker should only be used for feature requests and bugs with a clear description of the issue and the expected behaviour (see below). All questions belong on Slack, StackOverflow or Google groups.
Issues
Issues are always very welcome - after all, they are a big part of making sequelize better. However, there are a couple of things you can do to make the lives of the developers much, much easier:
Tell us:
- What you are doing?
- Post a minimal code sample that reproduces the issue, including models and associations
- What do you expect to happen?
- What is actually happening?
- Which dialect you are using (postgres, mysql etc)?
- Which sequelize version you are using?
When you post code, please use Github flavored markdown, in order to get proper syntax highlighting!
If you can even provide a pull request with a failing unit test, we will love you long time! Plus your issue will likely be fixed much faster.
Pull requests
We're glad to get pull request if any functionality is missing or something is buggy. However, there are a couple of things you can do to make life easier for the maintainers:
- Explain the issue that your PR is solving - or link to an existing issue
- Make sure that all existing tests pass
- Make sure you followed coding guidelines
- Add some tests for your new functionality or a test exhibiting the bug you are solving. Ideally all new tests should not pass without your changes.
- Use promise style in all new tests. Specifically this means:
- don't use
EventEmitter
,QueryChainer
or thesuccess
,done
anderror
events - don't use nested callbacks (use Promise.bind to maintain context in promise chains)
- don't use a done callback in your test, just return the promise chain.
- Small bugfixes and direct backports to the 1.7 branch are accepted without tests.
- If you are adding to / changing the public API, remember to add API docs, in the form of JSDoc style comments. See section 4a for the specifics.
- Add an entry to the changelog, with a link to the issue you are solving
Still interested? Coolio! Here is how to get started:
1. Prepare your environment
Here comes a little surprise: You need Node.JS.
2. Install the dependencies
Just "cd" into sequelize directory and run npm install
, see an example below:
$ cd path/to/sequelize
$ npm install
3. Database
3.a Local instances
For MySQL and PostgreSQL you'll need to create a DB called sequelize_test
.
For MySQL this would look like this:
$ echo "CREATE DATABASE sequelize_test;" | mysql -uroot
CLEVER NOTE: by default, your local MySQL install must be with username root
without password. If you want to customize that, you can set the environment variables SEQ_DB
, SEQ_USER
, SEQ_PW
, SEQ_HOST
and SEQ_PORT
.
For Postgres, creating the database and (optionally) adding the test user this would look like:
$ psql
# create database sequelize_test;
# create user postgres with superuser;
3.b Docker
Makes sure docker
and docker-compose
are installed.
If running on macOS, install Docker for Mac.
Now launch the docker mysql and postgres servers with this command (you can add -d
to run them in daemon mode):
$ docker-compose up postgres-95 mysql-57
4. Running tests
All tests are located in the test
folder (which contains the
lovely Mocha tests).
$ npm run test-all || test-mysql || test-sqlite || test-mssql || test-postgres || test-postgres-native
$ # alternatively you can pass database credentials with $variables when testing
$ DIALECT=dialect SEQ_DB=database SEQ_USER=user SEQ_PW=password npm test
For docker users you can use these commands instead
$ DIALECT=mysql npm run test-docker # Or DIALECT=postgres for Postgres SQL
# Only integration tests
$ DIALECT=mysql npm run test-docker-integration
5. Commit
Sequelize follows the AngularJS Commit Message Conventions. Example:
feat(pencil): add 'graphiteWidth' option
Commit messages are used to automatically generate a changelog, so make sure to follow the convention.
If you are unsure, you can let commitizen ask you questions and commit for you (just run node_modules/.bin/git-cz
).
When you commit, your commit message will be validated automatically with validate-commit-msg.
Then push and send your pull request. Happy hacking and thank you for contributing.
Coding guidelines
Have a look at our .eslintrc.json file for the specifics. As part of the test process, all files will be linted, and your PR will not be accepted if it does not pass linting.
Publishing a release (For Maintainers)
Note: You really don't need this as Sequelize use semantic-release, Travis will automatically release new version
- Ensure that latest build on master is green
- Ensure your local code is up to date (
git pull origin master
) -
npm version patch|minor|major
(see Semantic Versioning) - Update changelog to match version number, commit changelog
git push --tags origin master
npm publish .
- Copy changelog for version to release notes for version on github