Files
Orchard/src/Orchard.Web/Modules/Orchard.Blogs/DataMigrations/BlogsDataMigration.cs
Nathan Heskew 11bf66e6e6 Blog -> BlogPart; BlogPost -> BlogPostPart
- updating part names to conform to a <name>Part convention

--HG--
branch : dev
rename : src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogDriver.cs => src/Orchard.Web/Modules/Orchard.Blogs/Drivers/BlogPartDriver.cs
rename : src/Orchard.Web/Modules/Orchard.Blogs/Models/Blog.cs => src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogPart.cs
rename : src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogArchiveRecord.cs => src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogPartArchiveRecord.cs
rename : src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogRecord.cs => src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogPartRecord.cs
rename : src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogPost.cs => src/Orchard.Web/Modules/Orchard.Blogs/Models/BlogPostPart.cs
2010-07-22 11:08:14 -07:00

59 lines
2.3 KiB
C#

using System.Collections.Generic;
using Orchard.Blogs.Models;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Data.Migration;
namespace Orchard.Blogs.DataMigrations {
public class BlogsDataMigration : DataMigrationImpl {
public int Create() {
//CREATE TABLE Orchard_Blogs_BlogPartArchiveRecord (Id integer, Year INTEGER, Month INTEGER, PostCount INTEGER, Blog_id INTEGER, primary key (Id));
SchemaBuilder.CreateTable("BlogPartArchiveRecord", table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<int>("Year")
.Column<int>("Month")
.Column<int>("PostCount")
.Column<int>("BlogPart_id")
);
//CREATE TABLE Orchard_Blogs_BlogPartRecord (Id INTEGER not null, Description TEXT, PostCount INTEGER, primary key (Id));
SchemaBuilder.CreateTable("BlogPartRecord", table => table
.ContentPartRecord()
.Column<string>("Description")
.Column<int>("PostCount")
);
return 1;
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterTypeDefinition("Blog",
cfg => cfg
.WithPart("BlogPart")
.WithPart("CommonAspect")
.WithPart("IsRoutable")
);
ContentDefinitionManager.AlterTypeDefinition("BlogPost",
cfg => cfg
.WithPart("BlogPostPart")
.WithPart("CommonAspect")
.WithPart("PublishLaterPart")
.WithPart("IsRoutable")
.WithPart("BodyAspect")
);
return 2;
}
public int UpdateFrom2() {
ContentDefinitionManager.AlterPartDefinition(typeof(BlogPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }}
}));
return 3;
}
}
}