0
votes

When I go to local host it tells me this: Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=development Extracted source (around line #576): 579

  # Raises <tt>ActiveRecord::PendingMigrationError</tt> error if any migrations are pending.
  def check_pending!(connection = Base.connection)
    raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?(connection)
  end

  def load_schema_if_pending!

And when I go to run the code "rails db:migrate" It tells me this:

enter image description here

1
You've performed part of a migration, which has failed part way through. Rails is now trying to re-run that migration from scratch, resulting in duplicate column errors - Mark
If you can, drop the DB and then run the migrations again after reimporting - Mark
It says this:Couldn't drop database 'db/development.sqlite3' rake aborted! - CatadorDeTesguino
I'm suuuper new to programming, so I'm hiper lost:( haha thanks for the help! - CatadorDeTesguino
In other post it says to : 18 Usually when rake db:reset don't run or work for me, I just delete the development.sqlite3 and schema.rb files and re run the rake db:migrate command to regenerate both files. i did, then migrate, it only creates de sqlite file and fails again - CatadorDeTesguino

1 Answers

0
votes

As the migration error shows, you have a duplicate column: created_at.

You cannot add the column if it exists already.

You are probably creating this column in a previous migration either individually or with t.timestamps (which adds both created_at and updated_at), then trying to add it again in your failing migration.

Do a describe articles in your DB console to make sure created_at exists, and remove this migration.