I'm trying to associate two models (user & country) where:

· A country has\_many users.

· A user belongs\_to one country.

Also, I use UUIDs as Primary Key for the two models, so I don't have an :id type to relate them and only have strings to do it.
The countries are static but I will create a lot of users.

How should I relate this two models and which parameters should I write in the two functions in the schemas (has\_many & belongs\_to)? And which function should I call to relate them: cast\_assoc, build\_assoc or put\_assoc?

Thanks!!

```
  @primary_key {:uuid, :string, []}
  @derive {Phoenix.Param, key: :uuid}
  schema "countries" do
    field :country_name, :string

    has_many :users, UserManagement.User, foreign_key: :country_id
  end

```

```
  @primary_key {:uuid, :string, []}
  @derive {Phoenix.Param, key: :uuid}
  schema "users" do
    field :nickname, :string
    field :password, :string, virtual: true

    belongs_to :country, UserManagement.Country, references: :uuid

    timestamps()
  end

```