2
我想使用舊的Rails MySQL數據庫/表而不用新的Elixir應用程序進行更改。很明顯我遇到了created_at
和inserted_at
的問題。 https://hexdocs.pm/ecto/Ecto.Schema.html#timestamps/1說我可以解決它。但我無法讓它工作。使用`created_at`而不是'inserted_at`
這是我做的:
mix phoenix.new address_book --database mysql
cd address_book
mix phoenix.gen.html User users first_name last_name
mix phoenix.server
網/模型/ user.ex
defmodule AddressBook.User do
use AddressBook.Web, :model
schema "users" do
field :first_name, :string
field :last_name, :string
timestamps([{:created_at,:updated_at}])
end
[...]
但總比我收到以下錯誤:
如何我能解決這個問題嗎?
究竟應該在哪裏定義@timestamps_opts?找不到架構部分。 – raarts