mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 04:43:35 +08:00
Fix 1.0 to 1.1 migration issue
SiteSettings are used very early and often in Orchard, so we can't rely on having the user be able to run migration for SiteSettings. The workaround for 1.1 is to move the changes we did to SiteSettings into a new SiteSettings2 Part/Record. With this change, database compatiblity from 1.0 and 1.1 seems to be in a good working state on a real blog site. --HG-- branch : 1.x
This commit is contained in:
@@ -197,6 +197,8 @@
|
|||||||
<Compile Include="Scheduling\Services\ScheduledTaskManager.cs" />
|
<Compile Include="Scheduling\Services\ScheduledTaskManager.cs" />
|
||||||
<Compile Include="Scheduling\Services\ScheduledTaskExecutor.cs" />
|
<Compile Include="Scheduling\Services\ScheduledTaskExecutor.cs" />
|
||||||
<Compile Include="Scheduling\Models\Task.cs" />
|
<Compile Include="Scheduling\Models\Task.cs" />
|
||||||
|
<Compile Include="Settings\Models\SiteSettings2Part.cs" />
|
||||||
|
<Compile Include="Settings\Models\SiteSettings2PartRecord.cs" />
|
||||||
<Compile Include="Settings\ResourceManifest.cs" />
|
<Compile Include="Settings\ResourceManifest.cs" />
|
||||||
<Compile Include="Settings\Migrations.cs" />
|
<Compile Include="Settings\Migrations.cs" />
|
||||||
<Compile Include="Settings\Drivers\SiteSettingsPartDriver.cs" />
|
<Compile Include="Settings\Drivers\SiteSettingsPartDriver.cs" />
|
||||||
|
@@ -6,9 +6,11 @@ using Orchard.ContentManagement.Handlers;
|
|||||||
namespace Orchard.Core.Settings.Handlers {
|
namespace Orchard.Core.Settings.Handlers {
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class SiteSettingsPartHandler : ContentHandler {
|
public class SiteSettingsPartHandler : ContentHandler {
|
||||||
public SiteSettingsPartHandler(IRepository<SiteSettingsPartRecord> repository){
|
public SiteSettingsPartHandler(IRepository<SiteSettingsPartRecord> repository, IRepository<SiteSettings2PartRecord> repository2) {
|
||||||
Filters.Add(new ActivatingFilter<SiteSettingsPart>("Site"));
|
Filters.Add(new ActivatingFilter<SiteSettingsPart>("Site"));
|
||||||
|
Filters.Add(new ActivatingFilter<SiteSettings2Part>("Site"));
|
||||||
Filters.Add(StorageFilter.For(repository));
|
Filters.Add(StorageFilter.For(repository));
|
||||||
|
Filters.Add(StorageFilter.For(repository2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -97,9 +97,10 @@ namespace Orchard.Core.Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int UpdateFrom1() {
|
public int UpdateFrom1() {
|
||||||
SchemaBuilder.AlterTable("SiteSettingsPartRecord",
|
SchemaBuilder.CreateTable("SiteSettings2PartRecord",
|
||||||
table => table
|
table => table
|
||||||
.AddColumn<string>("BaseUrl", c => c.WithLength(255))
|
.ContentPartRecord()
|
||||||
|
.Column<string>("BaseUrl", c => c.Unlimited())
|
||||||
);
|
);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
|
12
src/Orchard.Web/Core/Settings/Models/SiteSettings2Part.cs
Normal file
12
src/Orchard.Web/Core/Settings/Models/SiteSettings2Part.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Data.Conventions;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Settings.Models {
|
||||||
|
public sealed class SiteSettings2Part : ContentPart<SiteSettings2PartRecord> {
|
||||||
|
[StringLengthMax]
|
||||||
|
public string BaseUrl {
|
||||||
|
get { return Record.BaseUrl; }
|
||||||
|
set { Record.BaseUrl = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
using Orchard.ContentManagement.Records;
|
||||||
|
using Orchard.Data.Conventions;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Settings.Models {
|
||||||
|
public class SiteSettings2PartRecord : ContentPartRecord {
|
||||||
|
[StringLengthMax]
|
||||||
|
public virtual string BaseUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Data.Conventions;
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
|
|
||||||
namespace Orchard.Core.Settings.Models {
|
namespace Orchard.Core.Settings.Models {
|
||||||
@@ -44,10 +45,14 @@ namespace Orchard.Core.Settings.Models {
|
|||||||
set { Record.PageSize = value; }
|
set { Record.PageSize = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[StringLength(255)]
|
[StringLengthMax]
|
||||||
public string BaseUrl {
|
public string BaseUrl {
|
||||||
get { return Record.BaseUrl; }
|
get {
|
||||||
set { Record.BaseUrl = value; }
|
return this.As<SiteSettings2Part>().BaseUrl;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this.As<SiteSettings2Part>().BaseUrl = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using Orchard.ContentManagement.Records;
|
||||||
using Orchard.ContentManagement.Records;
|
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
|
|
||||||
namespace Orchard.Core.Settings.Models {
|
namespace Orchard.Core.Settings.Models {
|
||||||
@@ -25,8 +24,5 @@ namespace Orchard.Core.Settings.Models {
|
|||||||
public virtual ResourceDebugMode ResourceDebugMode { get; set; }
|
public virtual ResourceDebugMode ResourceDebugMode { get; set; }
|
||||||
|
|
||||||
public virtual int PageSize { get; set; }
|
public virtual int PageSize { get; set; }
|
||||||
|
|
||||||
[StringLength(255)]
|
|
||||||
public virtual string BaseUrl { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user