The execution ends with an error referring to a undefined column. This column is one that was deleted after a data migration using it, see the following redacted output:
== 20240404103431 AddNewColumnsToTable: migrating
-- add_column(:table, :new_column1, :integer, {:null=>true})
-> 0.0090s
-- add_column(:table, :new_column2, :string, {:null=>true})
-> 0.0007s
== 20240404103431 AddNewColumnToTable: migrated (0.0098s)
== 20240404105505 MigrateDataFromOldColumnToNewColumns: migrating
== 20240404105505 MigrateDataFromOldColumnToNewColumns: migrated (0.0173s)
== 20240404105940 RemoveOldColumn: migrating ===============
-- remove_column(:table, :old_column, :string, {:null=>true})
-> 0.0070s
== 20240404105940 RemoveOldColumn: migrated (0.0071s) ======
... OTHER MIGRATIONS
Running seeds...
rails aborted!
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "old_column" of relation "table" does not exist
LINE 1: ...other_column1", "other_column2", "old_col...
^
/srv/app/db/seeds.rb:10:in `<main>'
Caused by:
PG::UndefinedColumn: ERROR: column "old_column" of relation "table" does not exist
LINE 1: ...other_column1", "other_column2", "old_col...
^
/srv/app/db/seeds.rb:10:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
This error is only throw if we run db:migrate:with_data instead of db:migrate, for example the following command runs without any error:
bundle exec rake db:create db:migrate db:seed
Or if we split the command in two, first creating and migrating the database and then seeding in another command it works too without any issues:
When creating, migrating and seeding the database for the first time, if we run
The execution ends with an error referring to a undefined column. This column is one that was deleted after a data migration using it, see the following redacted output:
This error is only throw if we run
db:migrate:with_data
instead ofdb:migrate
, for example the following command runs without any error:Or if we split the command in two, first creating and migrating the database and then seeding in another command it works too without any issues:
The problem seems to be related to run the seeds along the migration with data.
Here is some information about the versions:
7.0.4
9.3.0
Please let me know if you need any more information in order to look into this issue.