summaryrefslogtreecommitdiff
path: root/server/database
diff options
context:
space:
mode:
authorJoseph Ditton <jditton.atomic@gmail.com>2022-01-07 10:19:34 -0700
committerJoseph Ditton <jditton.atomic@gmail.com>2022-01-07 10:19:34 -0700
commitde84113066c27d88922285bd431b4968cf565a68 (patch)
tree9e093003d73e00b5ab0ddf3519633a6eb5d9d7e8 /server/database
parent5d9cf51c10f4477a107229f1d4f7fd0b1b89c893 (diff)
downloadlocchat-de84113066c27d88922285bd431b4968cf565a68.tar.gz
locchat-de84113066c27d88922285bd431b4968cf565a68.zip
adds context id to role and role helpers
Diffstat (limited to 'server/database')
-rw-r--r--server/database/migrations/1641570023672-AddContextIdToUserRole.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/database/migrations/1641570023672-AddContextIdToUserRole.ts b/server/database/migrations/1641570023672-AddContextIdToUserRole.ts
new file mode 100644
index 0000000..921c679
--- /dev/null
+++ b/server/database/migrations/1641570023672-AddContextIdToUserRole.ts
@@ -0,0 +1,18 @@
+import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
+
+export class AddContextIdToUserRole1641570023672 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.addColumn(
+ 'user_role',
+ new TableColumn({
+ name: 'contextId',
+ type: 'text',
+ default: "'root'", // default values must include single quotes for text
+ }),
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.dropColumn('user_role', 'contextId');
+ }
+}