switched to binary ids for db

This commit is contained in:
Adam Piontek 2021-03-05 12:59:41 -05:00
parent b0978d11b3
commit 9651887f34
6 changed files with 20 additions and 8 deletions
lib/bones73k

View file

@ -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

View file

@ -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

View file

@ -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