diff --git a/server/db/pg/schema/schema.ts b/server/db/pg/schema/schema.ts index 5f0fbf344..f9863c154 100644 --- a/server/db/pg/schema/schema.ts +++ b/server/db/pg/schema/schema.ts @@ -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"), diff --git a/server/setup/scriptsPg/1.22.0.ts b/server/setup/scriptsPg/1.22.0.ts index 7ca68a530..f39ebf2f5 100644 --- a/server/setup/scriptsPg/1.22.0.ts +++ b/server/setup/scriptsPg/1.22.0.ts @@ -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;`