moving from sqlite to mariadb

This commit is contained in:
Christoph Haas 2025-08-20 00:35:42 +02:00
parent 968b6b7fb6
commit c3f43cfd0e

View file

@ -1,27 +1,20 @@
--- ---
title: SQLite Database title: Database setup
lastUpdated: 2025-08-14 lastUpdated: 2025-08-14
slug: ispmail-trixie/sqlite slug: ispmail-trixie/database
sidebar: sidebar:
order: 155 order: 155
--- ---
import { Aside } from "@astrojs/starlight/components"; import { Aside } from "@astrojs/starlight/components";
Your mail server must know which domains and email addresses it is responsible for, so it can reject spam sent to Your mail server must know which domains and email addresses it is responsible for, so it can reject emails sent to
non-existent users. That information will be put into an SQLite database file that will be located at non-existent users. That information will be put into a database. We are using MariaDB for that purpose.
`/var/vmail/ispmail.sqlite`.
<Aside title="What is SQLite?">
SQLite is a lightweight, relational database that stores data in tables with rows and columns, just like bigger
database systems such as MySQL or PostgreSQL. Unlike those, it doesnt need a permanently running server process —
instead, its just a library your application uses directly, storing everything in a single file. This makes it easy
to set up, fast, and ideal for small projects.
</Aside>
The database will contain three tables: The database will contain three tables:
- virtual*domains: list of domains (\_name*) that your mail server is responsible for - virtual*domains: list of domains (\_name*) that your mail server is responsible for. A domain can have many mailboxes
and many aliases.
- virtual_users: list of email addresses that lead to mailboxes. We store the email address, a hashed/salted password - virtual_users: list of email addresses that lead to mailboxes. We store the email address, a hashed/salted password
and optionally a quota to limit the disk space usage. and optionally a quota to limit the disk space usage.
- virtual*aliases: list of email addresses (\_source*) that forward to other addresses (_destination_) - virtual*aliases: list of email addresses (\_source*) that forward to other addresses (_destination_)
@ -76,6 +69,10 @@ Graphically it looks like:
![ISPmail database schema](images/sqlite-schema.png) ![ISPmail database schema](images/sqlite-schema.png)
<Aside title="What are foreign keys?">
</Aside>
Paste the following block to create some test data to play with: Paste the following block to create some test data to play with:
```sql ```sql