Skip to content

Commit

Permalink
Renamed \upgradescripts\2.65-2.70(upcoming) directory to \upgradescri…
Browse files Browse the repository at this point in the history
…pts\2.65-2.70
  • Loading branch information
andreymaz committed Nov 29, 2012
1 parent 7ae0362 commit 2ac114a
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions upgradescripts/2.70-2.80(upcoming)/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Steps:
1. Backup your existing database
2. Execute upgrade.sql script over your database
3. Remove all files from the previous version except App_Data\Settings.txt and App_Data\InstalledPlugins.txt
4. Upload new site files
5. Copy back App_Data\Settings.txt and App_Data\InstalledPlugins.txt files
6. Ensure that everything is OK

Notes:
1. If you stored your pictures on the file system, then also backup them (\Content\Images\) and copy back after upgrade
87 changes: 87 additions & 0 deletions upgradescripts/2.70-2.80(upcoming)/upgrade.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
--upgrade scripts from nopCommerce 2.70 to nopCommerce 2.80

--new locale resources
declare @resources xml
--a resource will be delete if its value is empty
set @resources='
<Language>
<LocaleResource Name="">
<Value></Value>
</LocaleResource>
</Language>
'

CREATE TABLE #LocaleStringResourceTmp
(
[ResourceName] [nvarchar](200) NOT NULL,
[ResourceValue] [nvarchar](max) NOT NULL
)

INSERT INTO #LocaleStringResourceTmp (ResourceName, ResourceValue)
SELECT nref.value('@Name', 'nvarchar(200)'), nref.value('Value[1]', 'nvarchar(MAX)')
FROM @resources.nodes('//Language/LocaleResource') AS R(nref)

--do it for each existing language
DECLARE @ExistingLanguageID int
DECLARE cur_existinglanguage CURSOR FOR
SELECT [ID]
FROM [Language]
OPEN cur_existinglanguage
FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @ResourceName nvarchar(200)
DECLARE @ResourceValue nvarchar(MAX)
DECLARE cur_localeresource CURSOR FOR
SELECT ResourceName, ResourceValue
FROM #LocaleStringResourceTmp
OPEN cur_localeresource
FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue
WHILE @@FETCH_STATUS = 0
BEGIN
IF (EXISTS (SELECT 1 FROM [LocaleStringResource] WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName))
BEGIN
UPDATE [LocaleStringResource]
SET [ResourceValue]=@ResourceValue
WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName
END
ELSE
BEGIN
INSERT INTO [LocaleStringResource]
(
[LanguageId],
[ResourceName],
[ResourceValue]
)
VALUES
(
@ExistingLanguageID,
@ResourceName,
@ResourceValue
)
END

IF (@ResourceValue is null or @ResourceValue = '')
BEGIN
DELETE [LocaleStringResource]
WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName
END

FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue
END
CLOSE cur_localeresource
DEALLOCATE cur_localeresource


--fetch next language identifier
FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID
END
CLOSE cur_existinglanguage
DEALLOCATE cur_existinglanguage

DROP TABLE #LocaleStringResourceTmp
GO




0 comments on commit 2ac114a

Please sign in to comment.