Skip to main content
Solved

Post DB upgrade scripts - v12.5 to 15.2

  • October 29, 2021
  • 4 replies
  • 104 views

bskallerud
Hero (Customer)
Forum|alt.badge.img+12

I have upgraded our UAT environment (v15.2) with data from our live environment (v12.5). After running the upgrade utility, there are some additional SQL scripts that need run. Is there a comprehensive lists of scripts?

Right now we have problems with mobile, and the error message reads:

Error in DBAdapter.RunQuery: The INSERT statement conflicted with the FOREIGN KEY constraint "fk_tax_ln_tax_rate_1". The conflict occurred in database "UAT_2_v15_dk", table "dbo.tax_rate", column 'tax_rate_id'.
The statement has been terminated.

Best answer by Phil Seifert

Hi Bjorn,

Joshua is on the right track and I have sent you a mail with the scripts we used the last time this was found on your v15 environment in the original previous migration.  You probably need to run these same scripts again.

They should be run in the same order as designated above.

Please let us know if this resolves your issue.

Phil

4 replies

Forum|alt.badge.img+12
  • Superhero (Employee)
  • October 30, 2021

Hi,

Database upgrade from12.5 to 15.2 is quite a jump.

During the upgrade process when something is failing, you should be able to find out which exact line in the script that is failing from the upgrade log.

Once we know the script, we are closer to see what might have been missed.

The error looks like the script was trying to insert tax_line_details data, but the value in tax_rate_id does not exist in tax_rate table.


Forum|alt.badge.img+12
  • Superhero (Employee)
  • October 30, 2021

Assuming my above theory is correct, try to find tax_line.tax_rate_id which is not in tax_rate.tax_rate_id.

If you can find some data that means they are orphan data.

select * from tax_line where tax_rate_id is not null and not exists (select 'x' from tax_rate where tax_rate.tax_rate_id = tax_line.tax_rate_id).

Either you delete the bad tax_line or insert a new tax_rate with the missing tax_rate_id.

Please to be careful when deleting data, because tax_line is linked to an invoice and you don’t want to lose the tax.

To me inserting the missing tax_rate is more safe.

Once they have been sorted out, you can re-do the database upgrade again.


Phil Seifert
Ultimate Hero (Employee)
Forum|alt.badge.img+24
  • Ultimate Hero (Employee)
  • Answer
  • October 31, 2021

Hi Bjorn,

Joshua is on the right track and I have sent you a mail with the scripts we used the last time this was found on your v15 environment in the original previous migration.  You probably need to run these same scripts again.

They should be run in the same order as designated above.

Please let us know if this resolves your issue.

Phil


bskallerud
Hero (Customer)
Forum|alt.badge.img+12
  • Author
  • Hero (Customer)
  • November 1, 2021

Hi @Phil Seifert  thank you very much.

I can confirm that this fixed the issue