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
timestamps()
end
– 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)
end
create index(:taggables, [:user_id])
create index(:taggables, [:tag_id])
end
-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