mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-27 02:43:17 +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
|
@ -9,7 +9,11 @@ create table monitor_checks
|
|||
primary key autoincrement,
|
||||
type VARCHAR(50) not null,
|
||||
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
|
||||
|
@ -33,31 +37,6 @@ ALTER TABLE monitor DROP COLUMN 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;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue