AL icon indicating copy to clipboard operation
AL copied to clipboard

PS: Publish-NAVApp not creating tables in SQL

Open maze93 opened this issue 8 years ago • 4 comments

Hi all,

I haven't had this problem before. When I try to use the Publish-NAVApp cmdlet the package is deployed and all is good in extension management, however the tables aren't created in the SQL. It works like a charm with CTRL + F5 and the tables are created, however I want to use PS to deploy my projects.

No error messages in either PS or event viewer.

I use this normal cmdlet to publish my package: image

The first three marked tables have been created with VSCode (CTRL + F5), the last one (missing) should be named -8810.

image

Anybody else with this problem?

maze93 avatar Aug 20 '18 12:08 maze93

Hi again!

Update: It works the first time you publish the project with powershell but not the second. The first time the table doesn't exist so it creates it. The next time I try to add another table to the project and publish with powershell again - then it does not work. However, the table that was published first still exists but the second table is never generated in the SQL.


Another update: It does work all the time if i change the version number to one higher. It seems this is the solution. Strange that this hasn't occured before. But now I know how to work it, so it should be ok.

maze93 avatar Aug 20 '18 12:08 maze93

Publish-NavApp never creates tables (by design). That is the job of Sync-NavApp.

Think of it this way:

Publish = compile Sync = schema alteration Install = light up the logic

There are reasons for this, most notably the fact that publish is a system-wide concept, while sync (schema) is tied to a tenant database. It is possible to have 3 versions of an extension published to a given service with different versions synced/installed to various tenants. Schema also travels with a tenant when moving across different services, further supporting the need to decouple publish from the rest.

That said, you should familiarize yourself with the sync cmdlet documentation. The difference between sync modes is very important during development. Schema additions must be backwards compatible (more reasons I won't get into here), so invoking the -Mode Clean option is necessary in development if you need to start fresh.

Finally, the F5 VS Code flow wraps all these steps behind a single operation. That operation is not the same as a raw publish in PowerShell.

cmrudolph-msft avatar Aug 20 '18 14:08 cmrudolph-msft

Hi and thank you for your answer @cmrudolph-msft

This may be the problem that I am facing. I have one script with Sync-NAVApp and I have never had a problem with it (I created it to uninstall/reinstall all packages based on their dependencies). I have never had a problem with this script. However this time I used only Publish-NAVApp and then the problem occoured. I was wondering why this has never happened before when I have used the script and that may be the reason. I will try to do it again, this time with Sync-NAVApp and get back with the results.

Thanks!

maze93 avatar Aug 20 '18 14:08 maze93

Hi again,

Just wanted to tell you that your solution worked. You may close the issue :)

Thanks!

maze93 avatar Sep 05 '18 14:09 maze93