MobyDog
07/03/2023, 1:35 PMSELECT dbo.DLF.dlf_dlvId, dbo.umbracoNode.text AS dlf_fileName, dbo.cmsPropertyData.dataNvarchar AS dlf_url
FROM (lots of joins here for products/variations/download files)
INNER JOIN dbo.umbracoNode ON dbo.umbracoNode.id = dbo.DLF.dlf_fileNodeId
INNER JOIN dbo.cmsPropertyData ON dbo.cmsPropertyData.contentNodeId = dbo.DLF.dlf_fileNodeId AND dbo.cmsPropertyData.propertytypeid = 24
Files are uploaded via a custom section but essentially are Media section nodes. The cmsPropertyData table does not exist anymore. In some ways, the dbo.umbracoPropertyData table is similar but it's not an exact match and I can't seem to link them all up anymore. I can't find a new database schema.
For example, custom section has a downloadable file in DLF table with a fileNodeId of 4383 which matches up with the umbracoNode id and the id of the node in the Media folder for the relevant document. So I think that's been saved correctly.
However I need to get the filepath via SQL (the client wants SQL Views to set up on their extranet or something). The two tables I can find which will give me the filepath, eg "/media/2syoa44q/brochure.pdf" are umbracoMediaVersion and umbracoPropertyData. In uMV the id = 3686 and the same with the uPD table - it has id = 22326, version id = 3686 proptypeid = 46 and then varcharValue = the path.
Can't see how to to link these tables up so that I can grab the path if I have the fileNodeId from DLF - even via another table.Sebastiaan
07/03/2023, 4:14 PMumbracoFile property on it (that would be dbo.cmsPropertyData.propertytypeid = 24 in your previous query).
sql
SELECT nodeId FROM [dbo].[umbracoContentVersion]
WHERE id IN (
SELECT [versionId] FROM [dbo].[umbracoPropertyData]
WHERE propertyTypeId IN (
SELECT [id] FROM [dbo].[cmsPropertyType] WHERE alias = 'umbracoFile'
)
)
umbracoNode.Text is not necessarily the filename by the way, the textvalue in umbracoPropertyData is the file name.
I am sure you'll have follow-up questions but this is far as my SQL knowledge goes at the moment, I'd encourage you to investigate using our APIs for finding media nodes (not MediaService, that one does database queries). Not sure what your WHERE clause looks like though, so I might be off here,.MobyDog
07/03/2023, 4:28 PMSebastiaan
07/03/2023, 5:29 PMMobyDog
07/07/2023, 2:37 PM