add patch3.sql and fix duplicate id in EditMonitor.vue

This commit is contained in:
LouisLam 2021-07-22 17:44:59 +08:00
parent 86e18ac11d
commit 32a5e838ba
2 changed files with 39 additions and 2 deletions

37
db/patch3.sql Normal file
View File

@ -0,0 +1,37 @@
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
-- Add maxretries column to monitor
PRAGMA foreign_keys=off;
BEGIN TRANSACTION;
create table monitor_dg_tmp
(
id INTEGER not null
primary key autoincrement,
name VARCHAR(150),
active BOOLEAN default 1 not null,
user_id INTEGER
references user
on update cascade on delete set null,
interval INTEGER default 20 not null,
url TEXT,
type VARCHAR(20),
weight INTEGER default 2000,
hostname VARCHAR(255),
port INTEGER,
created_date DATETIME,
keyword VARCHAR(255),
maxretries INTEGER NOT NULL DEFAULT 0
);
insert into monitor_dg_tmp(id, name, active, user_id, interval, url, type, weight, hostname, port, created_date, keyword) select id, name, active, user_id, interval, url, type, weight, hostname, port, created_date, keyword from monitor;
drop table monitor;
alter table monitor_dg_tmp rename to monitor;
create index user_id on monitor (user_id);
COMMIT;
PRAGMA foreign_keys=on;

View File

@ -49,8 +49,8 @@
</div>
<div class="mb-3">
<label for="interval" class="form-label">Retry Pings</label>
<input type="number" class="form-control" id="interval" v-model="monitor.maxretries" required min="0" step="1">
<label for="maxRetries" class="form-label">Retry Pings</label>
<input type="number" class="form-control" id="maxRetries" v-model="monitor.maxretries" required min="0" step="1">
</div>
<div>