~sbaildon/yemma

5a66394dd890ed1e74577356105b5120af89fa7c — Sean Baildon 7 months ago b8c0bd6
datetime usec for timestamps
2 files changed, 5 insertions(+), 5 deletions(-)

M lib/yemma/migrations/000_users_tables.ex
M lib/yemma/users/user.ex
M lib/yemma/migrations/000_users_tables.ex => lib/yemma/migrations/000_users_tables.ex +3 -3
@@ 6,8 6,8 @@ defmodule Yemma.Migrations.CreateUsersTables do

    create table(:users) do
      email(repo().__adapter__)
      add(:confirmed_at, :utc_datetime)
      timestamps()
      add(:confirmed_at, :utc_datetime_usec)
      timestamps(type: :utc_datetime_usec)
    end

    create(unique_index(:users, [:email]))


@@ 17,7 17,7 @@ defmodule Yemma.Migrations.CreateUsersTables do
      add(:token, :binary, null: false)
      add(:context, :text, null: false)
      add(:sent_to, :text)
      timestamps(updated_at: false)
      timestamps(updated_at: false, type: :utc_datetime_usec)
    end

    create(index(:users_tokens, [:user_id]))

M lib/yemma/users/user.ex => lib/yemma/users/user.ex +2 -2
@@ 7,7 7,7 @@ defmodule Yemma.Users.User do
      @primary_key Keyword.get(opts, :primary_key, nil)
      schema "users" do
        field :email, :string
        field :confirmed_at, :naive_datetime
        field :confirmed_at, :utc_datetime_usec

        timestamps()
      end


@@ 55,7 55,7 @@ defmodule Yemma.Users.User do
  Confirms the account by setting `confirmed_at`.
  """
  def confirm_changeset(user) do
    now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
    now = DateTime.utc_now()
    change(user, confirmed_at: now)
  end
end