Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Drop all views with _SHARING in their name before creating .bacpac on T1 environment #731

Open
FH-Inway opened this issue May 5, 2023 · 3 comments

Comments

@FH-Inway
Copy link
Member

FH-Inway commented May 5, 2023

According to https://www.yammer.com/dynamicsaxfeedbackprograms/threads/2228926546395136, when a database sync is executed on a sandbox (T2+) environment (probably as part of a deployable package deployment), a field SYSSHARINGDATAAREAID is added to multiple tables and views are created with that field (e.g. VENDLEDGER_SHARINGVIEW).

When the sandbox database is then exported and imported to a T1 environment, the fields are removed from the tables, but the views with the now invalid field remain.

This causes an error when a .bacpac is exported from the T1 environment.

A workaround described in the Yammer thread is to drop the views before exporting the .bacpac. The views get recreated when the .bacpac is restored on a T2+ environment.

This could be accomplished with the -CustomSqlFile parameter of New-D365Bacpac. To make this more user friendly, we should consider adding the dropping of views with _SHARING in their name to Clear-SqlBacpacDatabase.sql, which gets called by New-D365Bacpac via the internal function Invoke-ClearSqlSpecificObjects

@Splaxi
Copy link
Collaborator

Splaxi commented Jul 12, 2023

Is this still an issue?

As we have extended the Clear-D365BacpacObject cmdlet, to be able to delete views directly inside the bacpac file.

We might need a cmdlet to list all Views, based on a wildcard pattern - as the current cmdlets isn't supporting that - and most likely shouldn't

@Splaxi
Copy link
Collaborator

Splaxi commented Jul 12, 2023

A cmdlet like: Get-D365BacpacTable, but only for objects.

Should be possible, to have it extract ALL objects of a specific type - and then filter on the name afterwards, to output the ones that matches the wildcard pattern.

Just an idea

@FH-Inway
Copy link
Member Author

I think a Get-D365BacpacObject cmdlet in general would be useful.

In this case, I was more thinking of an option that would resolve the issue "automagically" in the background, without the user ever having to bother with it. Running Get/Clear-D365BackpacObject probably requires a similar power user knowledge as the -CustomSqlFile parameter of New-D365Bacpac.

I haven't heard here or in the Yammer thread of any further issues with this. It might have been a one time thing with a specific version of D365FO. Unless there is more interest, I consider it low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants