fix(history-entry): remove composite primary keys

TypeORM promises to support composite primary keys,
but that does not work in reality.
This replaces the composite key used in the permission entities with
a single generated primary key and
a unique index on the relation columns.

See https://github.com/typeorm/typeorm/issues/8513

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-09-18 18:59:10 +02:00
parent d1c3058655
commit a626ace4b9
7 changed files with 60 additions and 55 deletions

View file

@ -313,7 +313,7 @@ describe('NotesService', () => {
expect(revisions).toHaveLength(1);
expect(revisions[0].content).toEqual(content);
expect(await newNote.historyEntries).toHaveLength(1);
expect((await newNote.historyEntries)[0].user).toEqual(user);
expect(await (await newNote.historyEntries)[0].user).toEqual(user);
expect(await newNote.userPermissions).toHaveLength(0);
expect(await newNote.groupPermissions).toHaveLength(0);
expect(await newNote.tags).toHaveLength(0);
@ -338,7 +338,7 @@ describe('NotesService', () => {
expect(revisions).toHaveLength(1);
expect(revisions[0].content).toEqual(content);
expect(await newNote.historyEntries).toHaveLength(1);
expect((await newNote.historyEntries)[0].user).toEqual(user);
expect(await (await newNote.historyEntries)[0].user).toEqual(user);
expect(await newNote.userPermissions).toHaveLength(0);
expect(await newNote.groupPermissions).toHaveLength(0);
expect(await newNote.tags).toHaveLength(0);