mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-27 10:53:16 +02:00
fix(monitor-checks): remove copy table migration
since we can now simply drop a column in sqlite 3.25.0 https://www.sqlite.org/releaselog/3_25_0.html
This commit is contained in:
parent
9a7323c2e7
commit
1742d62d5c
1 changed files with 8 additions and 29 deletions
|
@ -4,12 +4,16 @@ BEGIN TRANSACTION;
|
||||||
-- Create new monitor_checks table
|
-- Create new monitor_checks table
|
||||||
create table monitor_checks
|
create table monitor_checks
|
||||||
(
|
(
|
||||||
id INTEGER
|
id INTEGER
|
||||||
constraint monitor_checks_pk
|
constraint monitor_checks_pk
|
||||||
primary key autoincrement,
|
primary key autoincrement,
|
||||||
type VARCHAR(50) not null,
|
type VARCHAR(50) not null,
|
||||||
value TEXT,
|
value TEXT,
|
||||||
monitor_id INTEGER not null
|
monitor_id INTEGER NOT NULL,
|
||||||
|
CONSTRAINT "monitor_checks_monitor_id_fk"
|
||||||
|
FOREIGN KEY ("monitor_id")
|
||||||
|
REFERENCES "monitor" ("id")
|
||||||
|
ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
create unique index monitor_checks_id_uindex
|
create unique index monitor_checks_id_uindex
|
||||||
|
@ -33,31 +37,6 @@ ALTER TABLE monitor DROP COLUMN keyword;
|
||||||
|
|
||||||
UPDATE monitor SET type = 'http' WHERE type = 'keyword';
|
UPDATE monitor SET type = 'http' WHERE type = 'keyword';
|
||||||
|
|
||||||
|
|
||||||
-- Add foreign key back to monitor_checks
|
|
||||||
DROP INDEX "monitor_checks_id_uindex";
|
|
||||||
|
|
||||||
ALTER TABLE "monitor_checks" RENAME TO "monitor_checks_dg_tmp";
|
|
||||||
|
|
||||||
CREATE TABLE "monitor_checks" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"type" VARCHAR(50) NOT NULL,
|
|
||||||
"value" TEXT,
|
|
||||||
"monitor_id" INTEGER NOT NULL,
|
|
||||||
CONSTRAINT "monitor_checks_monitor_id_fk"
|
|
||||||
FOREIGN KEY ("monitor_id")
|
|
||||||
REFERENCES "monitor" ("id")
|
|
||||||
ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "monitor_checks" ("id", "type", "value", "monitor_id")
|
|
||||||
SELECT "id", "type", "value", "monitor_id" FROM "monitor_checks_dg_tmp";
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "monitor_checks_id_uindex"
|
|
||||||
ON "monitor_checks" (
|
|
||||||
"id" ASC
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue