Ask A Question

Notifications

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

Reply
Join the discussion
Create an account Log in

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

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

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