refactor(db): guard connexct statement instead

This commit is contained in:
parent 529120e936
commit 27f476a8a7
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -14,4 +14,4 @@ export const olduri =
? `mongodb://127.0.0.1/rockfic_old?authSource=admin`
: `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@127.0.0.1:27017/rockfic_old?authSource=admin`;
mongoose.connect(uri);
!mongoose.connection.modelNames().length && mongoose.connect(uri);