This adds a conditional statement before truncating the `schema_migrations` table. This comit also ports this code to Rails 5.