Skip to content

Extract users, memberships when copying a project

I wasn't able to directly use copy_table because of the approach that function takes with primary key popping/auto-incrementation/re-insertion, since users have a non-incrementing string primary key.

Instead, there's a series of execute calls to conditionally insert users into the dest if they do not already exist.

This allows a project with users A,B,C to safely be exported and imported to a given server and all the links between commands/users/memberships will be preserved. If a user with the same login as an exported user already exists, it is not re-inserted, but is added as a member of the imported project.

Closes: #248

Nice: the test coverage was quite good for export/import and gives me a lot of confidence that this works correctly on top of the manual testing I did.

Merge request reports