switched to binary ids for db
This commit is contained in:
parent
b0978d11b3
commit
9651887f34
6 changed files with 20 additions and 8 deletions
lib/bones73k
|
@ -16,6 +16,8 @@ defmodule Bones73k.Accounts.User do
|
|||
@max_password 80
|
||||
|
||||
@derive {Inspect, except: [:password]}
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "users" do
|
||||
field :email, :string
|
||||
field :password, :string, virtual: true
|
||||
|
|
|
@ -12,6 +12,8 @@ defmodule Bones73k.Accounts.UserToken do
|
|||
@change_email_validity_in_days 7
|
||||
@session_validity_in_days 60
|
||||
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "users_tokens" do
|
||||
field :token, :binary
|
||||
field :context, :string
|
||||
|
|
|
@ -2,11 +2,13 @@ defmodule Bones73k.Properties.Property do
|
|||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "properties" do
|
||||
field :description, :string
|
||||
field :name, :string
|
||||
field :price, :decimal
|
||||
field :user_id, :id
|
||||
belongs_to :user, Bones73k.Accounts.User
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue