Hey guys so in my Postgresql DB I have a table for Posts that looks like this
id
body
media //This is an integer array
And then I have a media table that looks like this
id
mimetype
So when I query a post, I would like the media integer array to be replaced with instances of the Media data type. Thing is I can't do the usual relational hasMany and belongsTo in sequelize because my Posts table and my Comments table will be sharing the Media table. How should I query for a Post using sequelize so that I get an array with the actual instances of a Media table row?
via Duxducis
No comments:
Post a Comment