From 863e8895a0e863bd55a9e7d2f169c8bea11fe6d9 Mon Sep 17 00:00:00 2001 From: John Supplee Date: Wed, 30 Jan 2019 17:14:48 +0200 Subject: [PATCH] Add the quota column to the users table --- README.md | 12 +++++++----- setup/mail-users.sh | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5b85800..be0fd72 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ Mail-in-a-Box with Quotas ========================= -This is an experimental implementation of Mail-in-a-box with quotas. Follow the directions below to install except -clone from this repository instead of the official repository. +This is an experimental implementation of Mail-in-a-box with quotas. Follow the directions below to install except clone from this repository instead of the official repository. -There is baisc support for quotas in the control panel now. To set quotas from the command line, set the `quota` -column for the user in the `users.sqlite` database. The `quota` column is text and allows for the `M` and `G` suffixes -for megabytes and gigabytes respectively. No spaces should be used in the quota value (e.g. `2G` or `100M`). +There is baisc support for quotas in the control panel now. To set quotas from the command line, either use `tools/mail.py` or set the `quota` +column for the user in the `users.sqlite` database. If you modify `users` table using SQL note the following: + +* The `quota` column is text and allows for the `M` and `G` suffixes for megabytes and gigabytes respectively. +* No spaces should be used in the quota value (e.g. `2G` or `100M`). Please report any bugs on github. + Todo ---- diff --git a/setup/mail-users.sh b/setup/mail-users.sh index d5f4541..ef0a99d 100755 --- a/setup/mail-users.sh +++ b/setup/mail-users.sh @@ -22,6 +22,10 @@ if [ ! -f $db_path ]; then echo Creating new user database: $db_path; echo "CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, password TEXT NOT NULL, extra, privileges TEXT NOT NULL DEFAULT '', quota TEXT NOT NULL DEFAULT '0');" | sqlite3 $db_path; echo "CREATE TABLE aliases (id INTEGER PRIMARY KEY AUTOINCREMENT, source TEXT NOT NULL UNIQUE, destination TEXT NOT NULL, permitted_senders TEXT);" | sqlite3 $db_path; +else + set +e + echo "ALTER TABLE users ADD COLUMN quota TEXT NOT NULL DEFAULT '0';" | sqlite3 $db_path; + set -e fi # ### User Authentication