Luke Gilliam

Joined

150 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in custom sql in migration breaks in test env?

Hi. I added a migration with SQL to create a full text search column. Worked fine in development, but when I pushed, our git hooks tried to run the tests, and I got a pending migrations error.

I am able to run all of the drop, create, and migrate commands manually with RAILS_ENV=test at the end, and I can see the tables in Postgres. schema_migrations is up to date, and rails db:migrate:status RAILS_ENV=test also showed no pending migrations. However, any attempt to run the tests generated the pending migrations error.

Currently running Rails 6.0.4.4 and Postgres 14.2. Anybody have experience with this/know how I can add back my SQL to get this column created? I have post-migration tasks that I've added it to for now, but that seems like a ticking time bomb.

Thanks!

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.