Overwriting db does not work with same admin username
Trying to overwrite an existing database in v0.3.1, if the username I'm giving the admin user is the same as the admin username of the previous db, I get an error.
Output below.
$pubsweet setupdb ./ --dev --clobber
info: Generating PubSweet app database at path api/db/dev
info: Database appears to already exist
info: Overwriting existing database due to --clobber flag
info: Setting up the database
question:><Admin username>< admin
question:><Admin email address>< admin@admin.com
question:><Admin password>< ***
question:><Initial collection title>< yolo
info: Received the following answers:
info: username: admin
info: email: admin@admin.com
info: password: <redacted>
info: collection: yolo
info: Setting up DB models in /home/barlas/code/temp/editoria/node_modules/pubsweet-server
error: database setup failed
error: Error: User already exists
at new ConflictError (/home/barlas/code/temp/editoria/node_modules/pubsweet-server/src/errors/ConflictError.js:6:11)
at User.isUniq (/home/barlas/code/temp/editoria/node_modules/pubsweet-server/src/models/User.js:44:13)
at process._tickCallback (internal/process/next_tick.js:109:7)