Set the target port from the resource

This commit is contained in:
Owen
2026-06-08 15:38:35 -07:00
parent 641f643d2d
commit 1b7c1ffa70
2 changed files with 15 additions and 0 deletions
+6
View File
@@ -274,6 +274,12 @@ export default async function migration() {
await db.execute( await db.execute(
sql`ALTER TABLE "targets" ADD "mode" text DEFAULT 'http' NOT NULL;` sql`ALTER TABLE "targets" ADD "mode" text DEFAULT 'http' NOT NULL;`
); );
await db.execute(sql`
UPDATE "targets"
SET "mode" = "resources"."mode"
FROM "resources"
WHERE "resources"."resourceId" = "targets"."resourceId";
`);
await db.execute(sql`ALTER TABLE "targets" ADD "authToken" text;`); await db.execute(sql`ALTER TABLE "targets" ADD "authToken" text;`);
await db.execute(sql`COMMIT`); await db.execute(sql`COMMIT`);
+9
View File
@@ -339,6 +339,15 @@ export default async function migration() {
ALTER TABLE 'targets' ADD 'mode' text DEFAULT 'http' NOT NULL; ALTER TABLE 'targets' ADD 'mode' text DEFAULT 'http' NOT NULL;
` `
).run(); ).run();
db.prepare(
`
UPDATE 'targets'
SET 'mode' = (
SELECT 'mode' FROM 'resources'
WHERE 'resources'.'resourceId' = 'targets'.'resourceId'
);
`
).run();
db.prepare( db.prepare(
` `
ALTER TABLE 'targets' ADD 'authToken' text; ALTER TABLE 'targets' ADD 'authToken' text;