As Sqlite is file-based, Chipper CI comes with Sqlite support.
The following can be configured to be used within a build:
- MySQL (5.6, 5.7, 8)
- MariaDB (10.3)
- PostgreSQL (10, 11, 12)
When using a database/cache, the following environment variables are set as system variables within the build container:
The following MySQL-specific environment variables are set:
The following PostgreSQL-specific environment variables are set:
chipperci(a database created for you)
The following Laravel-specific environment variables are set if you select a MySQL or PostgreSQL database.
Note that this means you don't need to define these yourself within a
For PostgreSQL, the
DB_CONNECTION will be named
pgsql, which is Laravel's default for PostgreSQL connections. The
DB_HOST will be
The following are used by Laravel and also happen to follow Chipper's environment variable naming convention.
Available Database Commands
The build container contains the following database command-line clients:
The build container is setup so you do NOT need to pass a username (and you will you be prompted for a password) for any client commands.
That being said, there are the above environment variables defined for you to use if you need. For example, you may want to create an additional MySQL/MariaDB database (the build container creates one for you by default):
# The `mysql` command is run as root, so make sure to give # user $MYSQL_USER permissions to any new database mysql -e "create database foo charset utf8mb4;" mysql -e "grant all privileges on *.* to '$MYSQL_USER'@'%'"; # You can run commands in PostgreSQL as well: PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USERNAME -c "create database foo;"
Some like to import a database dump prior to running tests. The available database commands can help you do that as well. For example,
to dump a
.sql file into MySQL, you may want to use a command similar to this:
# Import a .sql file mysql $DB_DATABASE < tests/my_database.sql # Import a .sql.gz file (decompress via gzip, then pipe to mysql) gunzip < my_database.sql.gz | mysql $DB_DATABASE