Fix database migration for group_id column
This commit is contained in:
1 parent
1e964d0c4c
commit
ec9362e14f
1 file changed
+2
-4
+2
-4
@@ -20,9 +20,7 @@ db.exec(`
|
||||
check_interval INTEGER DEFAULT 60000,
|
||||
timeout INTEGER DEFAULT 5000,
|
||||
enabled INTEGER DEFAULT 1,
|
||||
group_id INTEGER,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE SET NULL
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS checks (
|
||||
@@ -59,7 +57,7 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
db.prepare("ALTER TABLE resources ADD COLUMN group_id INTEGER").run();
|
||||
db.prepare("ALTER TABLE resources ADD COLUMN group_id INTEGER REFERENCES groups(id) ON DELETE SET NULL").run();
|
||||
} catch (err) {
|
||||
// Column already exists
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user