From 85e8df9615b83db854ca92fe51afaf44475727a7 Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Fri, 13 Jun 2025 22:37:16 +0200
Subject: [PATCH] add keypair columns in communities
---
.../0091-add_jwt-keypair_in_community_table.ts | 18 ++++++++++++++++++
database/src/entity/Community.ts | 6 ++++++
2 files changed, 24 insertions(+)
create mode 100644 database/migration/migrations/0091-add_jwt-keypair_in_community_table.ts
diff --git a/database/migration/migrations/0091-add_jwt-keypair_in_community_table.ts b/database/migration/migrations/0091-add_jwt-keypair_in_community_table.ts
new file mode 100644
index 000000000..21d5c44fc
--- /dev/null
+++ b/database/migration/migrations/0091-add_jwt-keypair_in_community_table.ts
@@ -0,0 +1,18 @@
+/* MIGRATION TO ADD JWT-KEYPAIR IN COMMUNITY TABLE
+ *
+ * This migration adds fields for the jwt-keypair in the community.table
+ */
+
+export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) {
+ await queryFn(
+ 'ALTER TABLE `communities` ADD COLUMN `public_jwt_key` varchar(512) DEFAULT NULL AFTER `gms_api_key`;',
+ )
+ await queryFn(
+ 'ALTER TABLE `communities` ADD COLUMN `private_jwt_key` varchar(2048) DEFAULT NULL AFTER `public_jwt_key`;',
+ )
+}
+
+export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) {
+ await queryFn('ALTER TABLE `communities` DROP COLUMN `public_jwt_key`;')
+ await queryFn('ALTER TABLE `communities` DROP COLUMN `private_jwt_key`;')
+}
diff --git a/database/src/entity/Community.ts b/database/src/entity/Community.ts
index 314e96f6a..b5e3f0ce4 100644
--- a/database/src/entity/Community.ts
+++ b/database/src/entity/Community.ts
@@ -54,6 +54,12 @@ export class Community extends BaseEntity {
@Column({ name: 'gms_api_key', type: 'varchar', length: 512, nullable: true, default: null })
gmsApiKey: string | null
+ @Column({ name: 'public_jwt_key', type: 'varchar', length: 512, nullable: true })
+ publicJwtKey: string | null
+
+ @Column({ name: 'private_jwt_key', type: 'varchar', length: 2048, nullable: true })
+ privateJwtKey: string | null
+
@Column({
name: 'location',
type: 'geometry',