switched database to postgresql and made code postgres compatible