500 error when trying to forward customers to v5

As the last part of my attempt to migrate to v5, I was trying to use the Forward customers to v5 area in settings, but whenever I clicked on submit, I would get a 500 error. When I checked the logs, I saw:

Column not found: 1054 Unknown column 'is_disabled' in 'field list' (SQL: update `account_email_settings` set `is_disabled` = 1, `forward_url_for_v5` = https://mydomain, `account_email_settings`.`updated_at` = 2021-11-22 14:35:28 where `id` = 1

so I went into the db and sure enough, those columns were not present for some reason. So I created them (is_disabled as INT, forward_url_for_v5 as VARCHAR), ran the command again, and this time it worked. I am just documenting this here in case it helps someone else. No idea why those columns were missing from the db, but this fixed it. (I hope)

Hi,

If you’re missing a column in the database the most common reason is a database migration needs to be run. You can run it with this command: php artisan migrate

I ran the upgrade script to upgrade to the latest v4 version (which I had run for every v4 version prior). Was there something new in the latest upgrades that made that script no longer valid? it was:

invoice_ninja_automatic_update_script_v4.7.1.sh

Thanks for the info!

cc @david

@satoristephen

It sounds like your migrations were not up to date on your v5 installation, you needed to run php artisan migrate on v5, i would have concerns about the state of your application now that you have manually created those columns.

About the state of my v5 application, or my v4 application?

Seems superficially ok I guess because when I run the migrate command now I get this:

Migrating: 2021_06_22_234707_add_forward_url_for_v5

In Connection.php line 669:

  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'forward_url_for_v5' (SQL: alter table `account_email_settings` add `forward_url_for_v5` t
  ext not null default '', add `is_disabled` tinyint(1) not null default '0')


In PDOStatement.php line 107:

  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'forward_url_for_v5'


In PDOStatement.php line 105:

  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'forward_url_for_v5'

yep, you will need to manually disable those and rerun the migration.