Solved

Post DB upgrade scripts - v12.5 to 15.2

  • 29 October 2021
  • 4 replies
  • 82 views

Userlevel 6
Badge +11

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.

icon

Best answer by Phil Seifert 31 October 2021, 11:53

View original

4 replies

Userlevel 6
Badge +10

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.

Userlevel 6
Badge +10

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.

Userlevel 7
Badge +21

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

Userlevel 6
Badge +11

Hi @Phil Seifert  thank you very much.

I can confirm that this fixed the issue

Reply