Supported Databases
Configuring Your Database
Using DATABASE_URL
The simplest way to configure your database is via theDATABASE_URL environment variable:
Using database.yml
You can also configure the database inconfig/database.yml. The connection pool is sized to cover web request threads plus background job threads, since jobs run inside the web container by default:
- PostgreSQL
- MySQL
- SQLite
Switching Databases
The easiest way to switch your existing Spree application to a different database is using the built-in Rails command:- Update your
Gemfilewith the correct database gem - Generate a new
config/database.ymlconfigured for the selected database
-
Install the new gem:
-
Create the new database and run migrations:
-
Optionally load sample data:
Creating a New App with a Specific Database
When creating a new Spree application with the manual installation method, pass the-d flag to rails new:
Cloud Database Services
For production deployments, you can use managed database services:
Set the
DATABASE_URL environment variable to the connection string provided by your cloud provider.
