Relation "user" does not exist for string Primary key relationship cant create the table

I’ve created table named User , Tags and taggables

Users has PK id as string
Tags has PK id as string

i want Taggables table to get associated with the two tables above

@primary_key {:id, :string, []}
@derive {Phoenix.Param, key: :id}
schema “taggables” do
field :createddate, :string

field :updateddate, :string
field :user_id, :id
field :tag_id, :id



– migrations
def change do
create table(:taggables, primary_key: false) do
add :id, :string, primary_key: true
add :createddate, :string
add :updateddate, :string
add :user_id, references(:user, on_delete: :nothing)
add :tag_id, references(:tag, on_delete: :nothing)

create index(:taggables, [:user_id])
create index(:taggables, [:tag_id])


-i dont understand why it is created if you just go with the defaults (int pk autoincrement)
-i already made the Users and Tags table

add :user_id, references(:users, on_delete: :nothing)
add :tag_id, references(:tags, on_delete: :nothing)

thanks problem solved … btw i also added some specifications

add :user_id, references(:users, on_delete: :nothing, column: :id, type: :string)
add :tag_id, references(:tags, on_delete: :nothing,column: :id, type: :string)

You might want to add null: false just in case …