diff --git a/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs b/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs index a14d63f3b..bf93a8d80 100644 --- a/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs +++ b/src/Orchard.Tests/DataMigration/SchemaBuilderTests.cs @@ -50,7 +50,6 @@ namespace Orchard.Tests.DataMigration { builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(session)).As(); builder.RegisterInstance(new ShellBlueprint { Records = Enumerable.Empty() }).As(); builder.RegisterInstance(new ShellSettings { Name = "temp", DataProvider = "SqlCe", DataTablePrefix = "TEST_" }).As(); - builder.RegisterType().As(); builder.RegisterModule(new DataModule()); _container = builder.Build(); @@ -153,8 +152,8 @@ namespace Orchard.Tests.DataMigration { .Column("City", DbType.String) .Column("ZIP", DbType.Int32, column => column.Unique()) .Column("UserId", DbType.Int32, column => column.NotNull())) - .CreateForeignKey("User_Address", "User", new[] { "UserId" }, "User", new[] { "Id" }) - .DropForeignKey("User", "User_Address"); + .CreateForeignKey("FK_User", "Address", new[] { "UserId" }, "User", new[] { "Id" }) + .DropForeignKey("Address", "FK_User"); } } diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/DataMigrations/BlogsDataMigration.cs b/src/Orchard.Web/Modules/Orchard.Blogs/DataMigrations/BlogsDataMigration.cs index 7662e34db..90603b3b0 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/DataMigrations/BlogsDataMigration.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/DataMigrations/BlogsDataMigration.cs @@ -25,6 +25,8 @@ namespace Orchard.Blogs.DataMigrations { .Column("PostCount") ); + SchemaBuilder.CreateForeignKey() + return 1; } diff --git a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs index 5b01da3e6..a72938d57 100644 --- a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs @@ -186,7 +186,7 @@ namespace Orchard.Data.Migration.Interpreters { builder.AppendFormat("alter table {0} alter column {1} ", _dialect.QuoteForTableName(PrefixTableName(command.TableName)), - _dialect.QuoteForColumnName(command.TableName)); + _dialect.QuoteForColumnName(command.ColumnName)); // type if (command.DbType != DbType.Object) { @@ -195,7 +195,7 @@ namespace Orchard.Data.Migration.Interpreters { // [default value] if (!string.IsNullOrEmpty(command.Default)) { - builder.Append(" default ").Append(command.Default).Append(Space); + builder.Append(" set default ").Append(command.Default).Append(Space); } _sqlStatements.Add(builder.ToString()); } @@ -250,7 +250,7 @@ namespace Orchard.Data.Migration.Interpreters { builder.Append(_dialect.GetAddForeignKeyConstraintString(command.Name, command.SrcColumns, - command.DestTable, + _dialect.QuoteForTableName(PrefixTableName(command.DestTable)), command.DestColumns, false)); @@ -266,7 +266,7 @@ namespace Orchard.Data.Migration.Interpreters { var builder = new StringBuilder(); - builder.AppendFormat("alter table {0} drop constraint {1}", command.SrcTable, command.Name); + builder.AppendFormat("alter table {0} drop constraint {1}", _dialect.QuoteForTableName(PrefixTableName(command.SrcTable)), command.Name); _sqlStatements.Add(builder.ToString()); RunPendingStatements(); diff --git a/src/Orchard/Data/Migration/Interpreters/SqlCeCommandInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/SQLiteCommandInterpreter.cs similarity index 90% rename from src/Orchard/Data/Migration/Interpreters/SqlCeCommandInterpreter.cs rename to src/Orchard/Data/Migration/Interpreters/SQLiteCommandInterpreter.cs index 637565da2..a490e911a 100644 --- a/src/Orchard/Data/Migration/Interpreters/SqlCeCommandInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/SQLiteCommandInterpreter.cs @@ -1,7 +1,7 @@ using Orchard.Data.Migration.Schema; namespace Orchard.Data.Migration.Interpreters { - public class SqlCeCommandInterpreter : + public class SQLiteCommandInterpreter : ICommandInterpreter, ICommandInterpreter, ICommandInterpreter, @@ -34,7 +34,7 @@ namespace Orchard.Data.Migration.Interpreters { } public string DataProvider { - get { return "SqlCe"; } + get { return "SQLite"; } } } } diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index f04a55bab..a5467f5c7 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -379,7 +379,7 @@ - +