update User, User group, IO modules
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
2026-06-23 11:06:26 +07:00
parent 523f98b74c
commit 50a2587cef
32 changed files with 4728 additions and 52 deletions

View File

@@ -108,6 +108,20 @@ CREATE TABLE IF NOT EXISTS transitions (
updated_at TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS io_modules (
id TEXT PRIMARY KEY,
site_id TEXT NOT NULL,
name TEXT NOT NULL,
module_type TEXT NOT NULL,
ip_address TEXT NOT NULL,
created_by TEXT NOT NULL DEFAULT '',
created_by_group TEXT NOT NULL DEFAULT '',
connected INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL,
FOREIGN KEY (site_id) REFERENCES sites(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS dashboards (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
@@ -395,6 +409,28 @@ bool Database::applySchemaMigrations(std::string& err)
setMeta("schema_version", "6");
}
ver = getMeta("schema_version").value_or("1");
if (ver == "6")
{
if (!execSql(db_,
"CREATE TABLE IF NOT EXISTS io_modules ("
"id TEXT PRIMARY KEY, "
"site_id TEXT NOT NULL, "
"name TEXT NOT NULL, "
"module_type TEXT NOT NULL, "
"ip_address TEXT NOT NULL, "
"created_by TEXT NOT NULL DEFAULT '', "
"created_by_group TEXT NOT NULL DEFAULT '', "
"connected INTEGER NOT NULL DEFAULT 0, "
"created_at TEXT NOT NULL, "
"updated_at TEXT NOT NULL, "
"FOREIGN KEY (site_id) REFERENCES sites(id) ON DELETE CASCADE"
")",
err))
return false;
setMeta("schema_version", "7");
}
return true;
}