microsoft / BCUpgrade

Unofficial Documentation on how to upgrade to the latest version of Business Central
Creative Commons Attribution 4.0 International
44 stars 21 forks source link

migration.json #29

Closed davmac1 closed 3 years ago

davmac1 commented 3 years ago

To follow along with your example, do I need a migration.json file? The online doc appears to state this is only needed for moving tables from one extension to another - an AL to AL move - that C/Side tables and fields being moved to an extension - C/AL to AL - the migration.json fle is not used.

Am I misunderstanding your example?

nikolakukrika commented 3 years ago

I believe you have understood it right.

Migration.json file is needed for AL to AL upgrade. It supports moving a table from one extension to another and extracting table extensions. Once you extract table extensions it is not possible to change them, the platform does not support it.

For C/AL to AL upgrade migration.json is not supported. If you want to extract added fields to table extensions you have to upgrade from C/AL to AL first (intermediary step) an then you need to do another upgrade to extract table extensions with migration.json.

The problem is that it is hard to move fields up the dependency chain (e.g. from BaseApp to the app that depends on the BaseApp). Each time you need to do this you will have to upgrade with intermediary step (Applicable for OnPrem)

There are two examples: 15X - Business Central 2019 Wave 2 - this example is C/AL to AL, just moving tables, not extracting fields Upgrade14To16ExtractFieldsToExtensions - this example is C/AL to AL (Tables Only), then AL (Tables Only) to AL System App, Base App + Extension on Top with table extensions.

davmac1 commented 3 years ago

In your example, it looks like it moves custom tables and custom fields in standard tables in the modified standard C/AL to an extension that has the same table numbers and fields. It looks like it does not care about name changes, so we can have our app use our assigned prefix. Am I correct?

davmac1 commented 3 years ago

I am trying to follow the steps in: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/upgrade-to-microsoft-base-app which look like I first need to create an app with all tables including customizations. This gets errors from the dropped product group table. Should I rather use your PowerShell script (which is a lot more complicated than your PowerPoint)? I have the additional challenge of cleaning up Classic tables that were not dropped after the previous conversion, so I am moving cautiously and trying to understand each step. The desired end result is an ISV app and a dependent custom app. My understanding is this process only looks at field and table numbers, so the new apps will use the new prefixed names when the table and field numbers match.

nikolakukrika commented 3 years ago

The PowerShell should be aligned with the docs, if it is not, please let me know and we should update one of them.

The rule is once you start AL upgrade, you should not have any SQL breaking changes. If you do, you need to force sync, which can do damage, thus I would not recommend it. If you are coming from C/AL do all breaking changes on 14. If you want to drop the tables, you can migrate them to the extension that you will uninstall.

Process looks at the SQL table definitions and it includes both table name and table number to compare the tables.

The process is as follows: Code preparation:

  1. You create Tables Only Base App extension and empty extensions for the final apps (Just with Json file)
  2. You create Full extensions that you will use in the end and delete tables from Tables Only Base App creating Empty Tables Only Base App. Update version to be slightly higher and add migration json to Empty Tables Only BaseApp.

Upgrade:

  1. You upgrade to Tables Only Base app from C/AL. This process must not contain any breaking changes. This will add guids to the end of the tables moving them from C/AL to AL. After this you publish blank apps so you can upgrade them in the next step.
  2. Then upgrade intermediary solution to final solution - Publish Empty Tables Only Base app with migration json, then publish full apps. Syncing should be done top down, with Empty Tables Only Base app synced last.
davmac1 commented 3 years ago

I created the Tables Only Base app from C/AL - but I am getting compile errors because the Product Group table (5723) is not supported. It is in your example base app. Do I need to switch to an earlier version of AL or is there a setting I can use to enable or compiling or should I do a force delete in BC14?

nikolakukrika commented 3 years ago

Tables only base app should be created from your own installation. It could be that my example is old. You can do this by using Txt2AL tool. There is a documentation topic on how to do this, just make sure you install the latest version.

Text 2 Al should be called like something like: txt2al --source=C:\export2al\bc14tablesonly --target=C:\export2al\bc14tablesonly\al --tableDataOnly

It is present in version 14.17. If you are on yammer you can find the info on this thread, if not we can add you if you have issues joining. https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=879678586896384&search_origin=global&scoring=linear1Y-prankie-group-private-higher&match=any-exact&search_sort=relevance&page=1&group_ids=5059035&search=txt2al

davmac1 commented 3 years ago

I already did this thanks. All my BC14 tables are there. When I did Ctrl-Shft-B to build it, got the error: error AL0433: Table 'Product Group' is removed. Reason: Product Groups became first level children of Item Categories..

So I cannot create the base app. I am using AL Language 6.1.352568

nikolakukrika commented 3 years ago

Is something referencing 'Product Group' in the code? Have all references been removed/deleted?

davmac1 commented 3 years ago

I did not have any code, but there was one ISV table with a table relationship to Product Group that was giving an error instead of a warning. I removed the table relationship, and it generated the app. BTW - my sole purpose is data migration from NAV 2017 to BC 16/17 - we already have our BC apps running on premise and in the cloud. Will BC17 on premise also support moving to the cloud or will we have to do it via BC16?

nikolakukrika commented 3 years ago

Super. The migration from 17 -> 17 cloud is already supported. Then you just need to migrate, select in the wizard Business Central. Upgrade Migration (select Business Central - Previous Version) is coming soon - hopefully this week.