When trying to deploy my Rails app to Railway I'm getting the following error:
ActiveRecord::PendingMigrationError
Migrations are pending. To resolve this issue, run:
bin/rails db:migrate RAILS_ENV=development
You have 1 pending migration:
20221102234102_create_contacts.rb
I'm able to get the app online by clicking a button that appears below the message, which says "Run Pending Migration". I would like to Find a method to auto run that migration every deploy.
I've tried everything listed in Getting: "Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue." after cloning and migrating the project
So I've run:
rm -f db/*.sqlite3
rake db:create
RAILS_ENV=development bundle exec rake db:migrate
rails s -e development
to no success.
The contents of the "20221102234102_create_contacts.rb" file are as follows:
class CreateContacts < ActiveRecord::Migration[7.0]
def change
create_table :contacts do |t|
t.string :name
t.string :email
t.text :comments
t.timestamps
end
end
end
I'm completely new to web development and was following a free bootcamps videos to get this far, but they are using Heroku and that was unsuccessful, and since Heroku will no longer be free I figured I should try Railway out instead.