GithubHelp home page GithubHelp logo

Comments (9)

ekryski avatar ekryski commented on May 12, 2024

@zusamann if you are just getting started I would use the new generator as mentioned here: #20 (comment).

It sets them up correctly for you now 😄 . The feathers-demos repos are starting to become stale and are in need of some TLC with all the updates that have gone into the Auk release.

If that works for you can we close this? 🙏

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

@ekryski fair enough, let me go try it out and I'll re-open the issue if I can't get it to work?

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

@ekryski I have tried it with feathers-cli and I am able to reproduce the error. For further verification I did another test where I used models and migrations written in the official example by sequelize for express.

What is happening is the data I send in the query for the relational field. It's somehow not getting processed and being set to null. I have noticed this in all my tests.

So let's say I have a customer with a relational field of contactId. And in customer/1 I do a PATCH of

{ "contactId": 1 }

The error response I see is null value in column "contactId" violates not-null constraint and also in the SQL query I see logged on the server there is no mention of this relational/reference field being updated.

Could it be a bug recently introduced? Using the following versions right now, must all be latest:

{
    "feathers": "^2.1.1",
    "feathers-hooks": "^1.8.1",
    "feathers-rest": "^1.7.1",
    "feathers-sequelize": "^1.4.3",
    "nodemon": "^1.11.0",
    "pg": "^6.1.5",
    "pg-hstore": "^2.3.2",
    "sequelize": "^3.30.2"
}

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

I have updated my sample repo here to showcase the exact same issue.

I have two resources here, a Channel and a Message, and just for this example I have only one message in each channel.

Now I'm able to create messages no problem.

// POST /messages { "text": "Hola!" }
{
  "createdAt": "2017-03-24T14:00:26.577Z",
  "updatedAt": "2017-03-24T14:00:26.577Z",
  "id": 1,
  "text": "Hola!",
  "ChannelId": null
}

Which is all good, but when I now try creating a new channel like so:

// POST localhost:3003/channels { "name": "hoo hoo lalala", "messageId": 1 }

Here is the SQL query that runs

INSERT INTO "Channel" ("id","name","createdAt","updatedAt") VALUES (DEFAULT,'hoo hoo lalala','2017-03-24 14:00:26.587 +00:00','2017-03-24 14:00:26.587 +00:00') RETURNING *;

As you can see, no mention of messageId in the above. Which is why I get this error:
SequelizeBaseError: null value in column "messageId" violates not-null constraint

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

Oh oh oh, I think it's a bug introduced in the recent version.

I downgraded from: "feathers-sequelize": "^1.4.3"
to: "feathers-sequelize": "^1.4.0"

And not facing the same issue anymore.

from feathers-sequelize.

daffl avatar daffl commented on May 12, 2024

Interesting. Could you try at which version (1.4.1, 1.4.2 or 1.4.3) it breaks? Eventually the caret (^) range should still install the latest version.

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

sure, let me try 1.4.1 and 1.4.2 and get back to you

from feathers-sequelize.

subodhpareek18 avatar subodhpareek18 commented on May 12, 2024

I could get it to work with the version 1.4.3 as well.
The issue was with the relations written in the migration.

My apologies.

from feathers-sequelize.

joeblubaugh avatar joeblubaugh commented on May 12, 2024

@zusamann Can you give some examples of the problems with your relations? I'm encountering a similar issue and understanding the model problems could help me too.

from feathers-sequelize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.