Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule MyApp.User do
- use MyApp.Web, :model
- @primary_key {:UserId, :id, autogenerate: true}
- schema "user" do
- has_one :credential, MyApp.Credential,
- foreign_key: :UserId,
- references: :UserId
- many_to_many :roles, MyApp.Role,
- join_through: MyApp.UserRole,
- join_keys: [UserId: :UserId, RoleId: :RoleId]
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement