我有一个项目,其中的数据库是redshift,我在phoenix项目中使用Postgrex适配器,在本地我使用postgresql,一切工作正常,但当我部署并尝试运行迁移时,我收到了这个错误。
15:39:27.201 [error] Could not create schema migrations table. This error usually happens due to the following:
* The database does not exist
* The "schema_migrations" table, which Ecto uses
今天,我经常尝试在我的菲尼克斯应用程序中创建mix ecto.migrate,并意外地发现了以下错误:
warning: could not find repositories for application :adah.
You can avoid this warning by passing the -r flag or by setting the
repositories managed by this application in your config files:
config :adah, ecto_repos: [...]
The configuration ma
我正在尝试使用Distillery创建我的Phoenix应用程序的一个版本,并且我已经覆盖了DateTime和NaiveDateTime的毒药编码器,以满足应用程序编程接口的要求。
当我运行mix release时,我的应用程序会编译,但在.boot生成过程中会出现错误。
下面是堆栈跟踪:
$> mix release
warning: variable "aliases" does not exist and is being expanded to "aliases()", please use parentheses to remove the am
我正在尝试将argon2_elixir添加到我的菲尼克斯项目中,但编译时会出现以下错误:
mix compile
==> argon2_elixir
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
makefile(34) : fatal error U1000: syntax error : ')' missing in macro invocation
Stop.
co
我目前正在进行一系列迁移,这些迁移创建了一些带有引用和一些唯一索引的表。当我想用mix ecto.migrate迁移表时,这似乎工作得很好,但是如果我想回滚,mix ecto.rollback会弹出下面的错误。在回滚期间,我是否需要更改迁移以添加一些内容来处理索引?
迁移步骤:
defmodule App.Repo.Migrations.CreateTokens do
use Ecto.Migration
def change do
create table(:tokens) do
add :token, :string
add :user_id, r
我对Elixir/Phoenix/Ecto不熟悉。我使用ecto.migration创建了一个具有4个不同模式的数据库。这些表是正确创建的,但是当我尝试查询这些表时,ecto找不到它们。
ERROR 42P01 (undefined_table): relation "users" does not exist
我知道这个问题是与数据库模式相关的,因为当我在默认模式中创建users表时,ecto可以毫不费力地找到它。
我正在用Elixir编写一个应用程序,使用Postgres作为数据存储。在Ecto中,我定义了这个实体:
defmodule MyModule.User do
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
schema "users" do
field :email, :string
end
@fields ~w(email)
def changeset(data, params \\ %{}) do
在运行mix ecto.create创建postgres DB时,我得到了下面的错误。
==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mi
我正在使用Phoenix Framework将Rails中编写的API重写为Elixir。
主网站使用Rails,并将继续使用Rails。但是,我希望API使用Elixir。
我需要能够从我的Elixir API项目中读取created_at字段。
defmodule Example.Recipe do
use Ecto.Schema
schema "recipes" do
field :name, :string
field :description, :string
field :slug, :string
field :creat
因此,我是一个新的长生不老药,但我找不到关于这方面的信息,我真的不明白这个问题。
比方说:
%Restaurant{} has many %Discount{}
%Discount{} has many %PromoCode{}
工厂:
def restaurant_factory do
%Restaurant{
discounts: [
build(:discount)
]
}
end
def discount_factory do
%Discount{
promo_codes: [
bu
嗨,我写了一系列大约50个迁移。 当我尝试运行eco.migrate时,它只会首先运行,我得到了这个奇怪的错误 ** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
The following arguments were given to IO.chardata_to_string/1:
# 1
nil
Attempted function clauses (showing 2 out of 2):
def chardata_to_string(
我正在使用菲尼克斯创建一个简单的API Rest。在执行命令时,我得到了以下错误: mix ecto.migrate
22:25:14.197 [error] Postgrex.Protocol (#PID<0.193.0>) failed to connect: ** (Postgrex.Error) FATAL (invalid_catalog_name): database "api_example_dev" does not exist
** (DBConnection.ConnectionError) connection not available be
我在Windows上,正在尝试安装bcrypt_elixir模块。
我得到以下错误:
$ mix phx.server
==> bcrypt_elixir
could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean
我正在尝试插入两条相关的记录。当我尝试创建新用户时。我想首先在pools表中创建一条记录,并将其‘id’传递给users' table pool_id`。我正在尝试使用Ecto.Multi,但没有成功。如果您能给我指导或帮助,我将不胜感激!提前感谢!我从未使用过Ecto.Multi,因此,如果您能给我解释一下,我将不胜感激。结尾处的错误。 下面是我的用户模式: schema "users" do
field :email, :string
field :full_name, :string
field :password_digest, :