Thanks for wanting to contribute to Diesel! We are very much looking forward to your suggestions, bug reports, and pull requests.
Aside from Github, we have an active Gitter channel, where you can ask questions and get help on how to use Diesel. Feel free to ask there before opening an issue or pull request on Github.
Remember: Anyone who interacts with Diesel in any space including but not limited to this GitHub repository is expected to follow our code of conduct.
Have a look at our issue tracker. If you can't find an issue (open or closed) describing your problem (or a very similar one) there, please open a issue with the following details:
Thank you! We'll try to get back to you as soon as possible.
If you can't find an issue (open or closed) describing your idea on our issue tracker, open an issue. It would be great if you could answer the following questions in your description:
Thank you! We'll try to get back to you as soon as possible.
Install Rust using rustup, which allows you to easily switch between Rust versions.
Install the system libraries needed to interface with the database systems you which to use.
These are the same as when compiling diesel. In general, it is a good idea to have all drivers installed so you can run all tests locally.
Shortcut: On macOS, you don‘t need to install anything to work with SQLite and for PostgreSQL you’ll only need the server (libpq
is installed by default). So, to get started, brew install postgresql mysql
and follow the instructions shown to set up the database servers.
Clone this repository and open it in your favorite editor.
Create a .env
file in this directory, and add the connection details for your databases.
See .env.sample for an example that should work with a trivial local setup.
Note: If you didn‘t specify the MySQL user to be one with elevated permissions, you’ll want to a command like mysql -c "GRANT ALL ON `diesel_%`.* TO ''@'localhost';" -uroot
, or something similar for the user that you've specified.
If you have Docker, the following snippet might be useful to get Postgres and MySQL running (with the above .env
file):
#!/usr/bin/env sh set -e docker run -d --name diesel.mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql while sleep 1; ! echo 'CREATE DATABASE diesel_test;' | docker exec -i diesel.mysql mysql do sleep 1; done docker run -d --name diesel.postgres -p 5432:5432 postgres while sleep 1; ! echo 'CREATE DATABASE diesel_test;' | docker exec -i diesel.postgres psql -U postgres do :; done
Now, try running the test suite to confirm everything works for you locally by executing bin/test
. (Initially, this will take a while to compile everything.)