This is not the issue, I am using PostgresQL through Heroku and the data is persisting just fine for over a week, and the heroku server shuts down after some inactivity as expected.
It seems to have solved itself after setting up a new Strapi project.
Every time i deployed a new build of the strapi project all the data would be lost but the collection types would remain.
But setting up a new strapi project solved it.