Thursday, 25 May 2017

How to get the storage size of the Postgres Database using sequelize.query in node.js?

here is what I have tried: but I get Internal server error when I access this api using Postman. No clue what is happening. Please help

 getDBStorageInfo: (req, res, next) => {
        Sequelize.query("SELECT pg_size_pretty( pg_total_relation_size('dbname'));", { type: sequelize.QueryTypes.SELECT})
        .then(function(dbsize) {
      // Each record will now be a instance of Project

      next({ data: dbsize, code: 200 }) 

    }).catch(err => helpers.errorHandler(err, req, res, next)); 
}



via user4101343

No comments:

Post a Comment