added weekdays enum and week_start_at for user records

This commit is contained in:
Adam Piontek 2021-03-12 11:15:22 -05:00
parent 4fb0e2df7b
commit 4031640e1d
4 changed files with 11 additions and 0 deletions

View file

@ -8,6 +8,7 @@ defmodule Shift73k.Repo.Migrations.CreateUsersAuthTables do
add(:id, :binary_id, primary_key: true)
add(:email, :citext, null: false)
add(:hashed_password, :string, null: false)
add(:week_start_at, :integer, null: false)
add(:confirmed_at, :naive_datetime)
timestamps()
end

View file

@ -66,6 +66,7 @@ mock_users =
email: e["email"],
role: String.to_existing_atom(e["role"]),
hashed_password: Bcrypt.hash_pwd_salt(e["password"]),
week_start_at: :rand.uniform(2),
inserted_at: add_dt,
updated_at: add_dt,
confirmed_at: (e["confirmed_at"] && NaiveDateTime.add(add_dt, 300, :second)) || nil