Alymosul / laravel-exponent-push-notifications

Exponent push notifications driver for laravel 5
MIT License
144 stars 77 forks source link

Interest Eloquent Model autoincrements by default - causing insert error for postgres #57

Closed paulmakarov closed 2 years ago

paulmakarov commented 4 years ago

When using Postgres 11+, after migration POST: https://my-example-domain.com/api/exponent/devices/subscribe { "status": "failed", "error": { "message": "SQLSTATE[42703]: Undefined column: 7 ERROR: column \"id\" does not exist\nLINE 1: ...n_interests\" (\"key\", \"value\") values ($1, $2) returning \"id\"\n ^ (SQL: insert into \"exponent_push_notification_interests\" (\"key\", \"value\") values (App.User.1, ExponentPushToken[<assume valid token>]) returning \"id\")" } }

I believe this is because we must explicitly set: protected $primaryKey = null; public $incrementing = false; in src/Models/Interest.php

Let me know. Thanks for the package!

Alymosul commented 4 years ago

That's because the migration is missing "id" as primary key which is the default primary key that Eloquent Models expect. So your solution is valid for this, but also i'm thinking of adding "id" column to the table.

AnthemCS commented 3 years ago

I've added a change migration for adding the "id" column to the table