Do not allow duplicate mounts

This commit is contained in:
Girish Ramakrishnan
2020-10-29 22:08:31 -07:00
parent 65eae30a48
commit cd3dc00f2f
3 changed files with 4 additions and 1 deletions

View File

@@ -85,7 +85,6 @@ CREATE TABLE IF NOT EXISTS apps(
dataDir VARCHAR(256) UNIQUE,
taskId INTEGER, // current task
errorJson TEXT,
bindsJson TEXT, // bind mounts
servicesConfigJson TEXT, // app services configuration
FOREIGN KEY(mailboxDomain) REFERENCES domains(domain),
@@ -248,6 +247,8 @@ CREATE TABLE IF NOT EXISTS volumes(
CREATE TABLE IF NOT EXISTS appMounts(
appId VARCHAR(128) NOT NULL,
volumeId VARCHAR(128) NOT NULL,
readOnly BOOLEAN DEFAULT 1,
UNIQUE KEY appMounts_appId_volumeId (appId, volumeId),
FOREIGN KEY(appId) REFERENCES apps(id),
FOREIGN KEY(volumeId) REFERENCES volumes(id));