當使用藥劑+鳳凰插入模型到MySQL數據庫我得到:鳳凰外生**(Mariaex.Error)(1054):未知列 'inserted_at' 在 '字段列表'
** (Mariaex.Error) (1054): Unknown column 'inserted_at' in 'field list'
stacktrace:
(ecto) lib/ecto/adapters/mysql.ex:181: Ecto.Adapters.MySQL.insert/5
(ecto) lib/ecto/repo/schema.ex:381: Ecto.Repo.Schema.apply/4
(ecto) lib/ecto/repo/schema.ex:185: anonymous fn/11 in Ecto.Repo.Schema.do_insert/4
(ecto) lib/ecto/repo/schema.ex:595: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6
(ecto) lib/ecto/adapters/sql.ex:472: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
(db_connection) lib/db_connection.ex:973: DBConnection.transaction_run/4
(db_connection) lib/db_connection.ex:897: DBConnection.run_begin/3
(db_connection) lib/db_connection.ex:671: DBConnection.transaction/3
這不是與其他模型發生,哪些工作正常。 型號模式是:
schema "accounts" do
field :key, :string, null: false
field :cypher_key, :string, null: false
field :another_key, :string, null: false
field :another_cypher_key, :string, null: false
belongs_to :user, MyApp.User
timestamps()
end
和插入,當我做:
Repo.insert! %Account{key: "test",
cypher_key: "test",
another_key: "test",
another_cypher_key: "pk_test"
}
當通過MySQL的手動插入在cmd它工作正常。
我錯過了,謝謝指出。 – David