add migration to add columns and drop existing traceroutes, also updated ui

This commit is contained in:
liamcottle
2024-04-16 14:15:25 +12:00
parent 3c492f37aa
commit 1386ed78c4
5 changed files with 51 additions and 22 deletions

View File

@ -0,0 +1,27 @@
/*
Warnings:
- You are about to drop the column `node_id` on the `traceroutes` table. All the data in the column will be lost.
- Added the required column `from` to the `traceroutes` table without a default value. This is not possible if the table is not empty.
- Added the required column `to` to the `traceroutes` table without a default value. This is not possible if the table is not empty.
- Added the required column `want_response` to the `traceroutes` table without a default value. This is not possible if the table is not empty.
*/
-- NOTE: manually added query, to drop existing traceroutes before adding required columns
TRUNCATE table `traceroutes`;
-- DropIndex
DROP INDEX `traceroutes_node_id_idx` ON `traceroutes`;
-- AlterTable
ALTER TABLE `traceroutes` DROP COLUMN `node_id`,
ADD COLUMN `from` BIGINT NOT NULL,
ADD COLUMN `to` BIGINT NOT NULL,
ADD COLUMN `want_response` BOOLEAN NOT NULL;
-- CreateIndex
CREATE INDEX `traceroutes_to_idx` ON `traceroutes`(`to`);
-- CreateIndex
CREATE INDEX `traceroutes_from_idx` ON `traceroutes`(`from`);

View File

@ -162,11 +162,11 @@ model TextMessage {
}
model TraceRoute {
id BigInt @id @default(autoincrement())
from_id BigInt @default(0)
to_id BigInt @default(0)
want_response Boolean @default(true)
route Json
id BigInt @id @default(autoincrement())
to BigInt
from BigInt
want_response Boolean
route Json
channel Int?
packet_id BigInt?
@ -178,8 +178,8 @@ model TraceRoute {
@@index(created_at)
@@index(updated_at)
@@index(from_id)
@@index(to_id)
@@index(to)
@@index(from)
@@map("traceroutes")
}