Commit 5a16f817 authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Added UNIQUE constraint on dmID & testEnv entry combination.

parent f3140948
......@@ -361,9 +361,9 @@ namespace MsgZfoTbl {
const QVector< QPair<QString, enum EntryType> > knownAttrs = {
{"dmID", DB_INTEGER}, /* NOT NULL*/
{"testEnv", DB_BOOLEAN},
{"lastAccessTime", DB_INTEGER},
{"size", DB_INTEGER},
{"testEnv", DB_BOOLEAN}, /* NOT NULL */
{"lastAccessTime", DB_INTEGER}, /* NOT NULL*/
{"size", DB_INTEGER}, /* NOT NULL*/
{"data", DB_TEXT}
/*
* PRIMARY KEY (id),
......@@ -372,13 +372,16 @@ namespace MsgZfoTbl {
};
const QMap<QString, QString> colConstraints = {
{"dmID", "NOT NULL"}
{"dmID", "NOT NULL"},
{"testEnv", "NOT NULL"},
{"lastAccessTime", "NOT NULL"},
{"size", "NOT NULL"}
};
const QString &tblConstraint(
",\n"
" CHECK (testEnv IN (0, 1)),\n"
" FOREIGN KEY(dmID) REFERENCES messages (dmID)"
" UNIQUE (dmID, testEnv)"
);
const QMap<QString, SQLiteTbl::AttrProp> attrProps = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment