netbird/management/server/migration
Mikhail Bragin 6ae27c9a9b
Refactor: support multiple users under the same account (#170)
* feature: add User entity to Account

* test: new file store creation test

* test: add FileStore persist-restore tests

* test: add GetOrCreateAccountByUser Accountmanager test

* refactor: rename account manager users file

* refactor: use userId instead of accountId when handling Management HTTP API

* fix: new account creation for every request

* fix: golint

* chore: add account creator to Account Entity to identify who created the account.

* chore: use xid ID generator for account IDs

* fix: test failures

* test: check that CreatedBy is stored when account is stored

* chore: add account copy method

* test: remove test for non existent GetOrCreateAccount func

* chore: add accounts conversion function

* fix: golint

* refactor: simplify admin user creation

* refactor: move migration script to a separate package
2021-12-27 13:17:15 +01:00
..
convert_accounts_test.go Refactor: support multiple users under the same account (#170) 2021-12-27 13:17:15 +01:00
convert_accounts.go Refactor: support multiple users under the same account (#170) 2021-12-27 13:17:15 +01:00
README.md Refactor: support multiple users under the same account (#170) 2021-12-27 13:17:15 +01:00

Migration from Store v2 to Store v2

Previously Account.Id was an Auth0 user id. Conversion moves user id to Account.CreatedBy and generates a new Account.Id using xid. It also adds a User with id = old Account.Id with a role Admin.

To start a conversion simply run the command below providing your current Wiretrustee Management datadir (where store.json file is located) and a new data directory location (where a converted store.js will be stored):

    ./migration --oldDir /var/wiretrustee/datadir --newDir /var/wiretrustee/newdatadir/  

Afterwards you can run the Management service providing /var/wiretrustee/newdatadir/ as a datadir.