Skip to content

Commit

Permalink
Fix postgresql errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Jan 11, 2025
1 parent e29b697 commit 39f2479
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
5 changes: 3 additions & 2 deletions app/gen-server/migration/1734097274107-GroupTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export class GroupTypes1734097274107 implements MigrationInterface {
await queryRunner.manager
.query('UPDATE groups SET type = $1', [Group.ROLE_TYPE]);

newColumn.isNullable = false;
const newColumnNonNull = newColumn.clone();
newColumnNonNull.isNullable = false;

await queryRunner.changeColumn('groups', newColumn.name, newColumn);
await queryRunner.changeColumn('groups', newColumn, newColumnNonNull);
}

public async down(queryRunner: QueryRunner): Promise<any> {
Expand Down
10 changes: 5 additions & 5 deletions test/gen-server/lib/homedb/UsersManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ describe('UsersManager', function () {
const idxIterator = makeUserIdIterator();
for (const [idx, resource] of resources.entries()) {
const aclRule = new AclRuleOrg();
const group = new Group();
if (makeResourceGrpName) {
group.name = makeResourceGrpName(idx);
}
const members = makeUsers(nbUsersByResource, idxIterator);
group.memberUsers = members;
const group = Group.create({
name: makeResourceGrpName?.(idx),
type: Group.ROLE_TYPE,
memberUsers: members
});
aclRule.group = group;
resource.aclRules = [
aclRule
Expand Down
15 changes: 5 additions & 10 deletions test/gen-server/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,10 @@ class Seed {
}

public async createGroups(parent?: Organization|Workspace): Promise<Groups> {
const owners = new Group();
owners.name = 'owners';
const editors = new Group();
editors.name = 'editors';
const viewers = new Group();
viewers.name = 'viewers';
const guests = new Group();
guests.name = 'guests';
const owners = Group.create({name: 'owners', type: Group.ROLE_TYPE});
const editors = Group.create({name: 'editors', type: Group.ROLE_TYPE});
const viewers = Group.create({name: 'viewers', type: Group.ROLE_TYPE});
const guests = Group.create({name: 'guests', type: Group.ROLE_TYPE});

if (parent) {
// Nest the parent groups inside the new groups
Expand All @@ -331,8 +327,7 @@ class Seed {

if (!parent) {
// Add the members group for orgs.
const members = new Group();
members.name = 'members';
const members = Group.create({name: 'members', type: Group.ROLE_TYPE});
await this.groupRepository.save(members);
return {
owners,
Expand Down

0 comments on commit 39f2479

Please sign in to comment.