Fix issue with subnets in migrations

This commit is contained in:
Owen
2026-08-18 17:50:32 -04:00
parent fb5b564c00
commit dc8e724482
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -105,7 +105,6 @@ export const sites = pgTable(
}),
name: varchar("name").notNull(),
pubKey: varchar("pubKey"),
subnet: varchar("subnet"),
exitNodeSubnet: text("exitNodeSubnet"), // this is the subnet when connecting to an exit node and INCLUDES THE CIDR
megabytesIn: real("bytesIn").default(0),
megabytesOut: real("bytesOut").default(0),
@@ -1325,7 +1324,8 @@ export const clients = pgTable(
olmId: text("olmId"), // to lock it to a specific olm optionally
name: varchar("name").notNull(),
pubKey: varchar("pubKey"),
exitNodeSubnet: varchar("exitNodeSubnet").notNull(), // INCLUDES THE CIDR
subnet: varchar("subnet").notNull(),
exitNodeSubnet: varchar("exitNodeSubnet"), // INCLUDES THE CIDR
megabytesIn: real("bytesIn"),
megabytesOut: real("bytesOut"),
lastBandwidthUpdate: varchar("lastBandwidthUpdate"),
+2 -2
View File
@@ -197,7 +197,7 @@ export default async function migration() {
);
`);
await db.execute(
sql`ALTER TABLE "clients" RENAME COLUMN "subnet" TO "exitNodeSubnet";`
sql`ALTER TABLE "clients" ADD COLUMN "exitNodeSubnet" text;`
);
await db.execute(
sql`ALTER TABLE "roles" ALTER COLUMN "sshSudoMode" SET DEFAULT 'full';`
@@ -232,7 +232,7 @@ export default async function migration() {
sql`ALTER TABLE "siteResources" ADD COLUMN "requiresExitNodeConnection" boolean DEFAULT false NOT NULL;`
);
await db.execute(
sql`ALTER TABLE "sites" ADD COLUMN "exitNodeSubnet" text;`
sql`ALTER TABLE "sites" RENAME COLUMN "subnet" TO "exitNodeSubnet";`
);
await db.execute(
sql`ALTER TABLE "targets" ADD COLUMN "providerId" integer;`