Add the quota column to the users table

This commit is contained in:
John Supplee 2019-01-30 17:14:48 +02:00
parent e40566967e
commit 863e8895a0
2 changed files with 11 additions and 5 deletions

View file

@ -1,15 +1,17 @@
Mail-in-a-Box with Quotas 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 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.
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` 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. The `quota` column is text and allows for the `M` and `G` suffixes column for the user in the `users.sqlite` database. If you modify `users` table using SQL note the following:
for megabytes and gigabytes respectively. No spaces should be used in the quota value (e.g. `2G` or `100M`).
* 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. Please report any bugs on github.
Todo Todo
---- ----

View file

@ -22,6 +22,10 @@ if [ ! -f $db_path ]; then
echo Creating new user database: $db_path; 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 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; 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 fi
# ### User Authentication # ### User Authentication