My downloadable files are not transferred to blob storage showing status failed in logs.

Avatar
  • Total Posts: 1

Omkar

Hello there,
I have installed blob cloud storage plugin in my project but as we discussed my downloadable files are not transferred to blob storage showing status failed in logs.


So I need little help how can I delete all downloadable files from database and all its entries from the database so that my code will run without an error in admin while editing product

"dbo.download" is the table in which my downloadable files are stored I want to delete these files with their reference tables please help with that

dbo.download is the table name it contains 5 records. Do I need to delete these records or is there any other solution to solve it?. An object reference is not set to an instance of an object is the error I am getting.

Avatar
  • Moderator
  • Total Posts: 85

Support

Hello Omkar,

Thank you for your message we will test moving downloads one more time.
As for your request. I think it’s earthier just to remove those records because a plugin upgrade will take some time.

1. Please backup your DB
2. Remove product downloads and order notes downloads
--remove products downloads
DECLARE @productFilter AS TABLE(
                ProductId int,
                DownloadId int
)

INSERT INTO @productFilter(ProductId, DownloadId)
SELECT DISTINCT p.Id AS ProductId, d.Id as DownloadId
  FROM [dbo].[Download] d
                INNER JOIN [dbo].[Product] p ON p.DownloadId=d.Id OR p.SampleDownloadId=d.Id
  WHERE DownloadBinary IS NOT NULL

UPDATE [dbo].[Product]
SET DownloadId=0,SampleDownloadId=0--, HasSampleDownload=0, IsDownload=0
WHERE Id in (SELECT DISTINCT ProductId FROM @productFilter)

DELETE [dbo].[Download]
WHERE Id in (SELECT DISTINCT DownloadId FROM @productFilter)

--remove order notes downloads
DECLARE @orderNoteFilter AS TABLE(
                OrderNoteId int,
                DownloadId int
)

INSERT INTO @orderNoteFilter(OrderNoteId, DownloadId)
SELECT DISTINCT note.Id AS OrderNoteId, d.Id as DownloadId
  FROM [dbo].[Download] d
                INNER JOIN [dbo].[OrderNote] note ON note.DownloadId=d.Id
  WHERE DownloadBinary IS NOT NULL

UPDATE [dbo].[OrderNote]
SET DownloadId=0
WHERE Id in (SELECT DISTINCT OrderNoteId FROM @orderNoteFilter)

DELETE [dbo].[Download]
WHERE Id in (SELECT DISTINCT DownloadId FROM @orderNoteFilter)

select * from @productFilter
select * from @orderNoteFilter


3. You will get the following result


So you will be able to use Products Id’s from the result table and upload your downloads if you need them.

Avatar
  • Total Posts: 1

afzal

Hi

We are creating an mobile app and its mobile service requires to get url of blob from tables
Can you please explain where is the url stored which table and how to retrieve it for a particular product.  
we need complete url of blob storage

Thanks

Avatar
  • Moderator
  • Total Posts: 85

Support

afzal wrote:
Can you please explain where is the url stored which table and how to retrieve it for a particular product.  
we need complete url of blob storage
Hi
[dbo].[Download]