title: Objection JS & Postgres & Exporess returning 'TypeError: Cannot read property 'isPartial' of null' on many to many relation query
body: <p>I am trying to relate table named 'products' to another table named 'tags'.
  I have a many to many table titled 'products_tags'.</p>
  
  <p>When running <code>const product = await Product.relatedQuery('tags').findById(1);</code> I receive the following error:</p>
  
  <pre class="lang-js prettyprint-override"><code>TypeError: Cannot read property 'isPartial' of null
      at findFirstNonPartialAncestorQuery (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\relations\RelationOwner.js:194:18)
      at Function.createParentReference (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\relations\RelationOwner.js:24:48)
      at QueryBuilder._findOperationFactory (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\model\Model.js:819:25)
      at addFindOperation (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\queryBuilder\QueryBuilder.js:1551:31)
      at addImplicitOperations (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\queryBuilder\QueryBuilder.js:1539:5)
      at beforeExecute (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\queryBuilder\QueryBuilder.js:1439:13)
      at QueryBuilder.execute (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\queryBuilder\QueryBuilder.js:681:13)
      at QueryBuilder.then (C:\Users\AmazeCPK\Documents\_Web\fractal-insight2\node_modules\objection\lib\queryBuilder\QueryBuilder.js:634:26)
      at runMicrotasks (&lt;anonymous&gt;)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  </code></pre>
  
  <p>My product model:</p>
  
  <pre class="lang-js prettyprint-override"><code>const {Model} = require('objection');
  
  class Product extends Model {
      static get tableName() {
          return 'products'
      }
  
      static get relationMappings() {
          const Tag = require('./Tag');
  
          return {
              tags: {
                  relation: Model.ManyToManyRelation,
                  modelClass: Tag,
                  join: {
                      from: 'products.id',
                      through: {
                          from: 'products_tags.product_id',
                          to: 'products_tags.tag_id'
                      },
                      to: 'tags.id'
                  }
              }
          }
      }
  }
  
  module.exports = Product;
  </code></pre>
  
  <p>Tags.js</p>
  
  <pre class="lang-js prettyprint-override"><code>const { Model } = require('objection');
  
  class Tag extends Model {
      static get tableName() {
          return 'tags';
      }
  
      static get relationMappings() {
          const Product = require ('./Product');
  
          return {
              products: {
                  relation: Model.ManyToManyRelation,
                  modelClass: Product,
                  join: {
                      from: 'tags.id',
                      through: {
                          from: 'products_tags.tag_id',
                          to: 'products_tags.product_id'
                      },
                      to: 'products.id'
                  }
              }
          }
      }
  }
  
  module.exports = Tag;
  </code></pre>
  
  <p>I've made sure the table names and relations are correct, as well as made sure there is matching data in the database. Help is appreciated. Thank you.</p>
  
  <p>edit: here is the migration setup</p>
  
  <pre class="lang-js prettyprint-override"><code>//...
          knex.schema.createTable('tags', table =&gt; {
              table.increments('id').notNullable();
              table.text("name");
              table.boolean("is_deleted").defaultTo(false);
              table.timestamps(true, true);
          }),
          knex.schema.createTable('products', table =&gt; {
              table.increments('id').notNullable();
              table.text("name");
              table.text("description");
              table.float("price");
              table.integer('category_id').references('id').inTable('categories');
              table.boolean("can_be_personalized").defaultTo(false);
              table.specificType('images', 'text ARRAY');
              table.boolean("is_deleted").defaultTo(false);
              table.timestamps(true, true);
          }),
          knex.schema.createTable('products_tags', table =&gt; {
              table.increments('id').notNullable();
              table.integer('product_id').references('id').inTable('products');
              table.integer('tag_id').references('id').inTable('tags');
              table.boolean("is_deleted").defaultTo(false);
              table.timestamps(true, true);
          }),
  </code></pre>