Configure database backends
This guide provides instructions on configuring new database backends or changing the existing database backend within your existing Marten projects.
Context
Marten officially supports MariaDB, MySQL, PostgreSQL, and SQLite3 databases. New Marten projects default to utilizing a SQLite3 database, a lightweight serverless database application that is typically pre-installed on most existing operating systems. This makes it an excellent choice for a development or testing database, but you may want to use a more powerful database such as MariaDB, MySQL, or PostgreSQL. In this light, this guide explains what steps should be taken in order to use your database backend of choice in a Marten project.
Prerequisites
This guide presupposes that you already have a functional Marten project available. If you don't, you can easily create one using the following command:
marten new project
Furthermore, it assumes that your preferred database is properly configured and ready for use. If this isn't the case, please consult the respective official documentation to install your chosen database:
- PostgreSQL Installation Guide
- MariaDB Installation Guide
- MySQL Installation Guide
- SQLite Installation Guide