Home > OS >  Sequelize Associations not showing up in pgAdmin
Sequelize Associations not showing up in pgAdmin

Time:12-13

I am creating restApi endpoints for a social media app like Instagram.

There are 4 tables

  1. User
  2. Post
  3. postLikes
  4. postMedia

Associations... A single user hasMany posts, A single post belongsTo one User, A post hasMany postLikes, A post hasMany postMedias, A postLike belongs to one post and belongs to one User, A postMedia belongs to one post,

If u are still a bit unclear pls comment any help will be much appreciated.

models/user.js

'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class User extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here           
  • Related