I’m trying retroactively add a user_id to some rows through a data migration following How to migrate Mix Release projects · The Phoenix Files.
When deploying my project I run into this error
** (Postgrex.Error) ERROR 23502 (not_null_violation) column "user_id" of relation "events" contains null values
table: events
column: user_id
(ecto_sql 3.11.3) lib/ecto/adapters/sql.ex:1054: Ecto.Adapters.SQL.raise_sql_call_error/1
(elixir 1.17.1) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(ecto_sql 3.11.3) lib/ecto/adapters/sql.ex:1161: Ecto.Adapters.SQL.execute_ddl/4
(ecto_sql 3.11.3) lib/ecto/migration/runner.ex:348: Ecto.Migration.Runner.log_and_execute_ddl/3
(elixir 1.17.1) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(ecto_sql 3.11.3) lib/ecto/migration/runner.ex:311: Ecto.Migration.Runner.perform_operation/3
(stdlib 5.2.3) timer.erl:270: :timer.tc/2
I then tried to manually do the data migration with bin/my_app eval 'MyApp.Release.migrate_data()'
and it says all to date but it is still not working.
Is there a way to see which data migrations I have ran or to better debug this problem?