Skip to content

Instantly share code, notes, and snippets.

@sajithdilshan
Created September 3, 2017 13:27
Show Gist options
  • Save sajithdilshan/0c8a81f937293daea76eb28e67b17751 to your computer and use it in GitHub Desktop.
Save sajithdilshan/0c8a81f937293daea76eb28e67b17751 to your computer and use it in GitHub Desktop.
defmodule Test.User do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_USERS" do
field :NAME, :string
belongs_to :TENANT, Test.Tenant, foreign_key: :TENANT_ID, references: :ID
many_to_many :GROUPS, Test.Group, join_through: "TEST_GROUPS_USERS", join_keys: [GROUP_ID: :ID, USER_ID: :ID]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment