Db:migrate error 1.22

Hello !

Problem:
i perform an update from 1.21 to 1.22, but i have wrong global parameter in foreman
the db:migrate cannot be done due to this wrong parameter

i have pending migration message in foreman
Service unavailable ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system.

if i try to remove global parameter with hammer cli :
Could not delete the global parameter :
Error: 503 Service Unavailable

how can i remove or fix this issue to finish update ?

Thanks !

Foreman and Proxy versions:
1.22

= 20181105061336 CastKeyTypesAndValuesInParameters: migrating ================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

740: unexpected token at '******"'

can you please paste the full stack trace?
If you know which parameter is causing the issue, you can delete it from foreman-rake console by using the following command:

Parameter.find(<parameter id here>).destroy

I have the same issue and it looks to be caused by hidden parameters.
I’ve opened Bug #27631: foreman-rake db:migrate fails with hidden parameters - Foreman.

@tbrisker is there a way to search by parameter name instead of id?

That is odd, could you please add the full stack trace to the bug report? @kgaikwad - can you take a look? looks like it’s failing in the migration for adding types to parameters.
You could find a parameter by name, but there may be more than one with the same name, so:

Parameter.where(name: 'parameter_name_here')

will get you the list of all of them, then you can select from that list the one that needs destroying using the id like above.

@tbrisker Thank you for your help! The problem was actually on my side… see #27631

Thank you @Anthony_Chevalet for updating issue with your findings.
After updating such param record(s), did you finish foreman update successfully?

Yes I’ve updated successfully, thank you and sorry for the noise.