Skip to content

Instantly share code, notes, and snippets.

@sajithdilshan
Last active September 3, 2017 13:46
Show Gist options
  • Save sajithdilshan/6fa2f0bdf085a2897227083db6ad18a4 to your computer and use it in GitHub Desktop.
Save sajithdilshan/6fa2f0bdf085a2897227083db6ad18a4 to your computer and use it in GitHub Desktop.
defmodule Test.Group do
use Test.Web, :model
@primary_key {:ID, :id, autogenerate: true}
schema "TEST_GROUPS" do
field :NAME, :string
belongs_to :TENANT, Test.Tenant, foreign_key: :TENANT_ID, references: :ID
has_many :PERMISSIONS, Test.Permission, foreign_key: :GROUP_ID, references: :ID
many_to_many :USERS, Test.User, 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