shlinked
shlinked copied to clipboard
error with `seeds.exs` when running `mix ecto.setup`
[debug] QUERY OK db=2.0ms queue=1.5ms idle=168.3ms
INSERT INTO "chat_conversations" ("profile_ids","title","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" [[3, 4], "Modern Talking", ~N[2021-09-20 17:28:21], ~N[2021-09-20 17:28:21]]
[debug] QUERY ERROR db=7.6ms queue=1.6ms idle=184.8ms
INSERT INTO "chat_conversation_members" ("owner","profile_id","inserted_at","updated_at") VALUES ($1,$2,$3,$4) RETURNING "id" [true, 3, ~N[2021-09-20 17:28:21], ~N[2021-09-20 17:28:21]]
** (Postgrex.Error) ERROR 23502 (not_null_violation) null value in column "conversation_id" of relation "chat_conversation_members" violates not-null constraint
table: chat_conversation_members
column: conversation_id
Failing row contains (1, t, null, 3, 2021-09-20 17:28:21, 2021-09-20 17:28:21, null).
(ecto_sql 3.7.0) lib/ecto/adapters/sql.ex:756: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto 3.7.1) lib/ecto/repo/schema.ex:744: Ecto.Repo.Schema.apply/4
(ecto 3.7.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
priv/repo/seeds.exs:20: (file)
Per suggestion from @cbh123, I commented out the offending lines in seeds.exs, and that did seem to work. I was then able to run mix ecto.drop and mix ecto.setup successfully.
Wanted to post this here for posterity and discussion of how to fix the issue!