fix(config): only connect in dbconfig if hasMigrated is false

This commit is contained in:
parent d2b4476b43
commit c467afc0c8
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -3,7 +3,7 @@ import * as dotenv from "dotenv";
import mongoose from "mongoose";
const FUCKYOU = "/rockfic/abc-rockfic-v3";
dotenv.config({ path: resolve("/home/rockfic/rockfic-staging/.env") });
export const hasMigrated = false;
export const hasMigrated = true;
console.log("indbconfig");
export const uri =
process.env.NODE_ENV == "development"
@ -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.connection.modelNames().length && mongoose.connect(uri);
!mongoose.connection.modelNames().length && !hasMigrated && mongoose.connect(uri);