All threads / custom sql in migration breaks in test env?
Ask A Question


You’re not receiving notifications from this thread.

custom sql in migration breaks in test env?

Luke Gilliam asked in Rails

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 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.


Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 66,029+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    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.