2010-07-21 17:59:17 -07:00
|
|
|
|
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;
|
2010-06-29 16:17:08 -07:00
|
|
|
|
|
|
|
|
|
namespace Orchard.Blogs.DataMigrations {
|
|
|
|
|
public class BlogsDataMigration : DataMigrationImpl {
|
|
|
|
|
|
|
|
|
|
public int Create() {
|
2010-07-22 11:08:14 -07:00
|
|
|
|
//CREATE TABLE Orchard_Blogs_BlogPartArchiveRecord (Id integer, Year INTEGER, Month INTEGER, PostCount INTEGER, Blog_id INTEGER, primary key (Id));
|
|
|
|
|
SchemaBuilder.CreateTable("BlogPartArchiveRecord", table => table
|
2010-07-08 15:18:13 -07:00
|
|
|
|
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
2010-06-29 16:17:08 -07:00
|
|
|
|
.Column<int>("Year")
|
|
|
|
|
.Column<int>("Month")
|
|
|
|
|
.Column<int>("PostCount")
|
2010-07-22 11:08:14 -07:00
|
|
|
|
.Column<int>("BlogPart_id")
|
2010-06-29 16:17:08 -07:00
|
|
|
|
);
|
|
|
|
|
|
2010-07-22 11:08:14 -07:00
|
|
|
|
//CREATE TABLE Orchard_Blogs_BlogPartRecord (Id INTEGER not null, Description TEXT, PostCount INTEGER, primary key (Id));
|
|
|
|
|
SchemaBuilder.CreateTable("BlogPartRecord", table => table
|
2010-07-08 15:18:13 -07:00
|
|
|
|
.ContentPartRecord()
|
2010-06-29 16:17:08 -07:00
|
|
|
|
.Column<string>("Description")
|
|
|
|
|
.Column<int>("PostCount")
|
|
|
|
|
);
|
|
|
|
|
|
2010-07-19 15:39:58 -07:00
|
|
|
|
return 1;
|
2010-06-29 16:17:08 -07:00
|
|
|
|
}
|
2010-07-21 17:59:17 -07:00
|
|
|
|
|
|
|
|
|
public int UpdateFrom1() {
|
2010-07-21 17:19:28 -07:00
|
|
|
|
ContentDefinitionManager.AlterTypeDefinition("Blog",
|
|
|
|
|
cfg => cfg
|
2010-07-22 11:08:14 -07:00
|
|
|
|
.WithPart("BlogPart")
|
2010-07-22 12:52:16 -07:00
|
|
|
|
.WithPart("CommonPart")
|
2010-07-23 01:01:49 -07:00
|
|
|
|
.WithPart("RoutePart")
|
2010-07-21 17:19:28 -07:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ContentDefinitionManager.AlterTypeDefinition("BlogPost",
|
|
|
|
|
cfg => cfg
|
2010-07-22 11:08:14 -07:00
|
|
|
|
.WithPart("BlogPostPart")
|
2010-07-22 12:52:16 -07:00
|
|
|
|
.WithPart("CommonPart")
|
2010-07-21 17:19:28 -07:00
|
|
|
|
.WithPart("PublishLaterPart")
|
2010-07-23 01:01:49 -07:00
|
|
|
|
.WithPart("RoutePart")
|
2010-07-22 12:52:16 -07:00
|
|
|
|
.WithPart("BodyPart")
|
2010-07-21 17:19:28 -07:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
2010-07-21 18:01:49 -07:00
|
|
|
|
|
|
|
|
|
public int UpdateFrom2() {
|
2010-07-22 11:08:14 -07:00
|
|
|
|
ContentDefinitionManager.AlterPartDefinition(typeof(BlogPart).Name, cfg => cfg
|
2010-07-21 17:59:17 -07:00
|
|
|
|
.WithLocation(new Dictionary<string, ContentLocation> {
|
|
|
|
|
{"Editor", new ContentLocation { Zone = "primary", Position = "1" }}
|
|
|
|
|
}));
|
2010-07-21 18:01:49 -07:00
|
|
|
|
return 3;
|
2010-07-21 17:59:17 -07:00
|
|
|
|
}
|
2010-06-29 16:17:08 -07:00
|
|
|
|
}
|
|
|
|
|
}
|