From 8f0a9a1e66e1349a90233424899933ddb5f35fcf Mon Sep 17 00:00:00 2001 From: James Harton Date: Sun, 8 Apr 2018 12:25:31 +1200 Subject: [PATCH] Fix timestamps to always create as `:utc_datetime`. --- config/config.exs | 10 +++++----- lib/faces/gallery/person.ex | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config/config.exs b/config/config.exs index f8a2192..1f40fbc 100644 --- a/config/config.exs +++ b/config/config.exs @@ -6,22 +6,22 @@ use Mix.Config # General application configuration -config :faces, - ecto_repos: [Faces.Repo] +config :faces, ecto_repos: [Faces.Repo] # Configures the endpoint config :faces, FacesWeb.Endpoint, url: [host: "localhost"], secret_key_base: "ThLNldzPhX4I3g7eg79qoWrA1dj48zfsJBwbivAgNXq3XxhIo8tYh7jtteExdh0N", render_errors: [view: FacesWeb.ErrorView, accepts: ~w(html json)], - pubsub: [name: Faces.PubSub, - adapter: Phoenix.PubSub.PG2] + pubsub: [name: Faces.PubSub, adapter: Phoenix.PubSub.PG2] # Configures Elixir's Logger config :logger, :console, format: "$time $metadata[$level] $message\n", metadata: [:user_id] +config :faces, Faces.Repo, migration_timestamps: [type: :utc_datetime] + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. -import_config "#{Mix.env}.exs" +import_config "#{Mix.env()}.exs" diff --git a/lib/faces/gallery/person.ex b/lib/faces/gallery/person.ex index 069d50f..d71122a 100644 --- a/lib/faces/gallery/person.ex +++ b/lib/faces/gallery/person.ex @@ -2,6 +2,8 @@ defmodule Faces.Gallery.Person do use Ecto.Schema import Ecto.Changeset + @timestamps_opts [type: :utc_datetime, usec: true] + schema "people" do field(:username, :string) field(:avatar_url, :string)