Skip to content

Commit aa42f9e

Browse files
committed
Minor fixes
1 parent afc7e61 commit aa42f9e

4 files changed

Lines changed: 19 additions & 18 deletions

File tree

src/Libraries/SmartStore.Data/Migrations/201403112331027_Initial.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,13 +1774,13 @@ public override void Up()
17741774
#endregion
17751775

17761776
#region Custom
1777-
1778-
this.SqlFile("Indexes.sql");
1777+
1778+
this.SqlFileOrResource("Indexes.sql");
17791779
if (HostingEnvironment.IsHosted && DataSettings.Current.IsSqlServer)
17801780
{
17811781
// do not execute in unit tests
1782-
this.SqlFile("Indexes.SqlServer.sql");
1783-
this.SqlFile("StoredProcedures.sql");
1782+
this.SqlFileOrResource("Indexes.SqlServer.sql");
1783+
this.SqlFileOrResource("StoredProcedures.sql");
17841784
}
17851785

17861786
#endregion
@@ -1790,12 +1790,12 @@ public override void Down()
17901790
{
17911791
#region Custom
17921792

1793-
this.SqlFile("Indexes.Inverse.sql");
1793+
this.SqlFileOrResource("Indexes.Inverse.sql");
17941794
if (HostingEnvironment.IsHosted && DataSettings.Current.IsSqlServer)
17951795
{
17961796
// do not execute in unit tests
1797-
this.SqlFile("Indexes.SqlServer.Inverse.sql");
1798-
this.SqlFile("StoredProcedures.Inverse.sql");
1797+
this.SqlFileOrResource("Indexes.SqlServer.Inverse.sql");
1798+
this.SqlFileOrResource("StoredProcedures.Inverse.sql");
17991799
}
18001800

18011801
#endregion

src/Libraries/SmartStore.Data/Migrations/201504131412183_NewCategoryProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override void Up()
1818

1919
if (HostingEnvironment.IsHosted && DataSettings.Current.IsSqlServer)
2020
{
21-
this.SqlFile("LatestProductLoadAllPaged.sql");
21+
this.SqlFileOrResource("LatestProductLoadAllPaged.sql");
2222
}
2323
}
2424

src/Libraries/SmartStore.Data/Migrations/201506261756463_PrimaryStoreCurrencyMultiStore.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace SmartStore.Data.Migrations
22
{
33
using System.Data.Entity.Migrations;
44
using System.Linq;
5+
using System.Web.Hosting;
56
using SmartStore.Core.Data;
67
using SmartStore.Core.Domain.Configuration;
78
using SmartStore.Core.Domain.Directory;
@@ -16,7 +17,7 @@ public override void Up()
1617
AddColumn("dbo.Store", "PrimaryExchangeRateCurrencyId", c => c.Int(nullable: false, defaultValue: 1));
1718

1819
// avoid conflicts with foreign key constraint
19-
if (DataSettings.Current.IsSqlServer)
20+
if (HostingEnvironment.IsHosted && DataSettings.Current.IsSqlServer)
2021
{
2122
// what sql-server compact does not support here:
2223
// - Update Set with a select sub-query
@@ -28,23 +29,23 @@ public override void Up()
2829
Sql("Update dbo.Store Set PrimaryExchangeRateCurrencyId = (Select Min(Id) From dbo.Currency)");
2930
}
3031

31-
CreateIndex("dbo.Store", "PrimaryStoreCurrencyId");
32-
CreateIndex("dbo.Store", "PrimaryExchangeRateCurrencyId");
32+
CreateIndex("dbo.Store", "PrimaryStoreCurrencyId");
33+
CreateIndex("dbo.Store", "PrimaryExchangeRateCurrencyId");
3334

3435
AddForeignKey("dbo.Store", "PrimaryExchangeRateCurrencyId", "dbo.Currency", "Id");
3536
AddForeignKey("dbo.Store", "PrimaryStoreCurrencyId", "dbo.Currency", "Id");
3637
}
3738

3839
public override void Down()
3940
{
40-
DropForeignKey("dbo.Store", "PrimaryStoreCurrencyId", "dbo.Currency");
41-
DropForeignKey("dbo.Store", "PrimaryExchangeRateCurrencyId", "dbo.Currency");
41+
DropForeignKey("dbo.Store", "PrimaryStoreCurrencyId", "dbo.Currency");
42+
DropForeignKey("dbo.Store", "PrimaryExchangeRateCurrencyId", "dbo.Currency");
4243

43-
DropIndex("dbo.Store", new[] { "PrimaryExchangeRateCurrencyId" });
44-
DropIndex("dbo.Store", new[] { "PrimaryStoreCurrencyId" });
44+
DropIndex("dbo.Store", new[] { "PrimaryExchangeRateCurrencyId" });
45+
DropIndex("dbo.Store", new[] { "PrimaryStoreCurrencyId" });
4546

46-
DropColumn("dbo.Store", "PrimaryExchangeRateCurrencyId");
47-
DropColumn("dbo.Store", "PrimaryStoreCurrencyId");
47+
DropColumn("dbo.Store", "PrimaryExchangeRateCurrencyId");
48+
DropColumn("dbo.Store", "PrimaryStoreCurrencyId");
4849
}
4950

5051
public bool RollbackOnFailure

src/Libraries/SmartStore.Data/Setup/IDbMigrationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace SmartStore.Data.Setup
1616
public static class IDbMigrationExtensions
1717
{
1818

19-
public static void SqlFile(this IDbMigration migration, string fileName, Assembly assembly = null, string location = null)
19+
public static void SqlFileOrResource(this IDbMigration migration, string fileName, Assembly assembly = null, string location = null)
2020
{
2121
Guard.ArgumentNotEmpty(() => fileName);
2222

0 commit comments

Comments
 (0)