Skip to content

Commit b655c99

Browse files
authored
Add admin role to builtin admin back (#19337)
1 parent 1d44c43 commit b655c99

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License.AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { MigrationInterface, QueryRunner } from "typeorm";
8+
import { BUILTIN_INSTLLATION_ADMIN_USER_ID } from "../../user-db";
9+
10+
export class AdminUserAddAdminRole1705591447620 implements MigrationInterface {
11+
public async up(queryRunner: QueryRunner): Promise<void> {
12+
await queryRunner.query(
13+
`UPDATE d_b_user SET rolesOrPermissions = '["admin"]' WHERE id = '${BUILTIN_INSTLLATION_ADMIN_USER_ID}'`,
14+
);
15+
}
16+
17+
public async down(queryRunner: QueryRunner): Promise<void> {
18+
await queryRunner.query(
19+
`UPDATE d_b_user SET rolesOrPermissions = '[]' WHERE id = '${BUILTIN_INSTLLATION_ADMIN_USER_ID}'`,
20+
);
21+
}
22+
}

0 commit comments

Comments
 (0)