add keypair columns in communities

This commit is contained in:
clauspeterhuebner 2025-06-13 22:37:16 +02:00
parent 657862048e
commit 85e8df9615
2 changed files with 24 additions and 0 deletions

View File

@ -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<Array<any>>) {
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<Array<any>>) {
await queryFn('ALTER TABLE `communities` DROP COLUMN `public_jwt_key`;')
await queryFn('ALTER TABLE `communities` DROP COLUMN `private_jwt_key`;')
}

View File

@ -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',