yassine

yassine

Invited_by_id` in `insert` does not match type :id (PowInvitation)

Hi everyone, i have a problem with powinvitation library and i wish if some one can help me.
So, i will explain my problem with screenshots:
*) create_user migration file:

*) add pow invitation migration file:

*) add organization id for user migration file:

*) create organization migration file:

And for the schemas, i have:
*) user schema:

*) organization schema:

but when i run it a got this problem:

Most Liked

thiagomajesk

thiagomajesk

I suspect that you are trying to save a string as an uuid. You should try using Ecto.UUID.dump!/1 to cast that value to a binary first. I had the same problem some time ago.

If that’s not the case (if you are using a changeset to cast the values for example), check if you field is actually an uuid/ binary_id as you seem to be trying to persist one.

PS.: Also, if possible, replace the screenshots with markup so the forum search can properly index it. This will make your post more accessible to other people searching for a similar solution.

Update: Seems that your user schema is setting @primary_key as uuid but you are not specifying a @foreign_key_type even though you are referencing the users table by the invited_by_id fk. Could you also check that please?

dimitarvp

dimitarvp

Yeah, I was about to post that they should also make sure @foreign_key_type is properly set.

@yassine There’s also a way to configure these globally in the config/*.exs files for the entire Repo.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New

Other popular topics Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement