mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using Orchard.ContentManagement.Drivers;
|
|
using Orchard.ContentManagement.MetaData;
|
|
using Orchard.ContentManagement.MetaData.Builders;
|
|
using Orchard.Core.Contents.Extensions;
|
|
using Orchard.Core.Localization.Models;
|
|
using Orchard.Data.Migration;
|
|
|
|
namespace Orchard.Core.Localization {
|
|
public class Migrations : DataMigrationImpl {
|
|
|
|
public int Create() {
|
|
//CREATE TABLE Localization_LocalizedRecord (Id INTEGER not null, CultureId INTEGER, MasterContentItemId INTEGER, primary key (Id));
|
|
SchemaBuilder.CreateTable("LocalizationPartRecord", table => table
|
|
.ContentPartRecord()
|
|
.Column<int>("CultureId")
|
|
.Column<int>("MasterContentItemId")
|
|
);
|
|
|
|
return 1;
|
|
}
|
|
public int UpdateFrom1() {
|
|
ContentDefinitionManager.AlterPartDefinition(typeof(LocalizationPart).Name, cfg => cfg
|
|
.WithLocation(new Dictionary<string, ContentLocation> {
|
|
{"Default", new ContentLocation { Zone = "Primary", Position = "5" }},
|
|
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }},
|
|
}));
|
|
return 2;
|
|
}
|
|
|
|
public int UpdateFrom2() {
|
|
ContentDefinitionManager.AlterPartDefinition("LocalizationPart", builder => builder.Attachable());
|
|
return 3;
|
|
}
|
|
}
|
|
} |