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

Content Injection - Upgrade issue if site uses DNN db prefix #178

Closed
moorecreative opened this issue Dec 20, 2019 · 5 comments
Closed

Content Injection - Upgrade issue if site uses DNN db prefix #178

moorecreative opened this issue Dec 20, 2019 · 5 comments
Labels

Comments

@moorecreative
Copy link

upgrade from earlier version fails when running the 2.0.2 install upgrade. SQL errors occur and they appear to be related to DNN database prefix issues.

If a DNN db has a prefix such as "dnn_" then the install script of the module appears to incorrectly apply that prefix to database system level items such as syscolumns

for example (from the errors):

IF NOT EXISTS 
( 
       SELECT 1 
       **_FROM   dbo.[dnn_syscolumns] c 
       JOIN   dbo.[dnn_sysobjects] o_** 
       ON     c.[id] = o.[id] 
       WHERE  c.[name] = N'custom_properties' 
       AND    o.[name] = 'dnn_wns_inj_injection') 
ALTER TABLE dbo.[dnn_wns_inj_injection] ADD [custom_properties] NVARCHAR(max) NULL;

This runs correctly as soon as it is corrected to dbo.[syscolumns] vs dbo.[dnn_syscolumns]

@WillStrohl
Copy link
Owner

That's odd... I've never run into the upgrade error myself. :(

I just looked at the source, and the last version which had SQL updates was 2.0.0. 🤔

Just to be clear.... Is this the line of code you're talking about though?

https://github.com/hismightiness/dnnextensions/blob/master/Modules/WillStrohl.Injection/Providers/DataProviders/SqlDataProvider/02.00.00.SqlDataProvider#L18

Also, you're saying that the prefix on syscolumns needs to be removed in the scenarios where an objectQualifier is being used.... Right?

FYI - on a side note, any site using objectQualifier needs to be updated to not use them ASAP. You won't be able to upgrade directly in the future without doing so. They're going away. Sorry for the crap news. :( (If you need help with that, please let me know.)

@moorecreative
Copy link
Author

moorecreative commented Dec 27, 2019 via email

@WillStrohl WillStrohl added the bug label Dec 27, 2019
@WillStrohl
Copy link
Owner

WillStrohl commented Dec 27, 2019

In my experience, every time I've run into objectQualifiers, they weren't actually being used for what they were intended for. It has always appeared to be something that someone filled in during install, not knowing what it was intended for, nor the consequences of it. :(

By the way, removing them makes DNN more compatible with better-known vendors/extensions like 2xc and Mandeeps too. (We've had to do the work of removing them just to upgrade client websites that had one of those extensions installed.)

Thanks again for reporting this. :)

@moorecreative
Copy link
Author

moorecreative commented Dec 27, 2019 via email

@MaiklT
Copy link

MaiklT commented Nov 24, 2020

The line must look like this:

IF NOT EXISTS (SELECT 1 FROM {databaseOwner}[syscolumns] c JOIN {databaseOwner}[sysobjects] o ON c.[id] = o.[id] WHERE c.[name] = N'custom_properties' AND o.[name] = '{objectQualifier}wns_inj_injection')

because syscolumns and sysobjects don't have a qualifier. They are System Views in SQL Server.

WillStrohl added a commit that referenced this issue Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants