mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Compacting migrations
--HG-- branch : dev
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Common {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
public int Create() {
|
||||
//CREATE TABLE Common_BodyPartRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("BodyPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("BodyPartRecord",
|
||||
table => table
|
||||
.ContentPartVersionRecord()
|
||||
.Column<string>("Text", column => column.Unlimited())
|
||||
.Column<string>("Format")
|
||||
);
|
||||
|
||||
//CREATE TABLE Common_CommonPartRecord (Id INTEGER not null, OwnerId INTEGER, CreatedUtc DATETIME, PublishedUtc DATETIME, ModifiedUtc DATETIME, Container_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommonPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("CommonPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<int>("OwnerId")
|
||||
.Column<DateTime>("CreatedUtc")
|
||||
@@ -27,38 +23,18 @@ namespace Orchard.Core.Common {
|
||||
.Column<int>("Container_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Common_CommonPartVersionRecord (Id INTEGER not null, CreatedUtc DATETIME, PublishedUtc DATETIME, ModifiedUtc DATETIME, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommonPartVersionRecord", table => table
|
||||
SchemaBuilder.CreateTable("CommonPartVersionRecord",
|
||||
table => table
|
||||
.ContentPartVersionRecord()
|
||||
.Column<DateTime>("CreatedUtc")
|
||||
.Column<DateTime>("PublishedUtc")
|
||||
.Column<DateTime>("ModifiedUtc")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(BodyPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Default", new ContentLocation { Zone = "Primary", Position = "5" }},
|
||||
}));
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(CommonPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Default", new ContentLocation { Zone = "metadata", Position = "5" }},
|
||||
{"Editor", new ContentLocation { Zone = "Primary", Position = "20" }},
|
||||
}));
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int UpdateFrom3() {
|
||||
ContentDefinitionManager.AlterPartDefinition("BodyPart", builder => builder.Attachable());
|
||||
ContentDefinitionManager.AlterPartDefinition("CommonPart", builder => builder.Attachable());
|
||||
return 4;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
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
|
||||
SchemaBuilder.CreateTable("LocalizationPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<int>("CultureId")
|
||||
.Column<int>("MasterContentItemId")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("LocalizationPart", builder => builder.Attachable());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,52 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Navigation {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Navigation_MenuItemRecord (Id INTEGER not null, Url TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("MenuItemPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("MenuItemPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Url")
|
||||
.Column<string>("Url", column => column.WithLength(1024))
|
||||
);
|
||||
|
||||
//CREATE TABLE Navigation_MenuPartRecord (Id INTEGER not null, MenuText TEXT, MenuPosition TEXT, OnMainMenu INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("MenuPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("MenuPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("MenuText")
|
||||
.Column<string>("MenuPosition")
|
||||
.Column<bool>("OnMainMenu")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("Blog", cfg => cfg.WithPart("MenuPart"));
|
||||
ContentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.WithPart("MenuPart"));
|
||||
ContentDefinitionManager.AlterTypeDefinition("MenuItem", cfg => cfg.WithPart("MenuPart"));
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(MenuPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Editor", new ContentLocation { Zone = "Primary", Position = "9" }}
|
||||
}));
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int UpdateFrom3() {
|
||||
ContentDefinitionManager.AlterPartDefinition("MenuPart", builder => builder.Attachable());
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,9 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Core.PublishLater.Models;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.PublishLater {
|
||||
|
@@ -1,38 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Routable {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Routable_RoutableRecord (Id INTEGER not null, Title TEXT, Slug TEXT, Path TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("RoutePartRecord", table => table
|
||||
SchemaBuilder.CreateTable("RoutePartRecord",
|
||||
table => table
|
||||
.ContentPartVersionRecord()
|
||||
.Column<string>("Title", column => column.WithLength(1024))
|
||||
.Column<string>("Slug")
|
||||
.Column<string>("Path", column => column.WithLength(2048))
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("RoutePart", builder => builder.Attachable());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(RoutePart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Editor", new ContentLocation { Zone = "Primary", Position = "before.5" }}
|
||||
} ));
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition("RoutePart", builder => builder.Attachable());
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,8 +5,9 @@ namespace Orchard.Core.Scheduling {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Scheduling_ScheduledTaskRecord (Id integer, TaskType TEXT, ScheduledUtc DATETIME, ContentItemVersionRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ScheduledTaskRecord", table => table
|
||||
|
||||
SchemaBuilder.CreateTable("ScheduledTaskRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("TaskType")
|
||||
.Column<DateTime>("ScheduledUtc")
|
||||
|
@@ -1,26 +1,25 @@
|
||||
using System.Data;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Core.Settings {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Settings_ContentFieldDefinitionRecord (Id integer, Name TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentFieldDefinitionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentFieldDefinitionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ContentPartDefinitionRecord (Id integer, Name TEXT, Hidden INTEGER, Settings TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentPartDefinitionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentPartDefinitionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<bool>("Hidden")
|
||||
.Column<string>("Settings", column => column.Unlimited())
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ContentPartFieldDefinitionRecord (Id integer, Name TEXT, Settings TEXT, ContentFieldDefinitionRecord_id INTEGER, INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentPartFieldDefinitionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentPartFieldDefinitionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<string>("Settings", column => column.Unlimited())
|
||||
@@ -28,8 +27,8 @@ namespace Orchard.Core.Settings {
|
||||
.Column<int>("ContentPartDefinitionRecord_Id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ContentTypeDefinitionRecord (Id integer, Name TEXT, DisplayName TEXT, Hidden INTEGER, Settings TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentTypeDefinitionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentTypeDefinitionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<string>("DisplayName")
|
||||
@@ -37,28 +36,28 @@ namespace Orchard.Core.Settings {
|
||||
.Column<string>("Settings", column => column.Unlimited())
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ContentTypePartDefinitionRecord (Id integer, Settings TEXT, ContentPartDefinitionRecord_id INTEGER, ContentTypeDefinitionRecord_Id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentTypePartDefinitionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentTypePartDefinitionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Settings", column => column.Unlimited())
|
||||
.Column<int>("ContentPartDefinitionRecord_id")
|
||||
.Column<int>("ContentTypeDefinitionRecord_Id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ShellDescriptorRecord (Id integer, SerialNumber INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ShellDescriptorRecord", table => table
|
||||
SchemaBuilder.CreateTable("ShellDescriptorRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("SerialNumber")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ShellFeatureRecord (Id integer, Name TEXT, ShellDescriptorRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ShellFeatureRecord", table => table
|
||||
SchemaBuilder.CreateTable("ShellFeatureRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<int>("ShellDescriptorRecord_id"));
|
||||
|
||||
//CREATE TABLE Settings_ShellFeatureStateRecord (Id integer, Name TEXT, InstallState TEXT, EnableState TEXT, ShellStateRecord_Id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ShellFeatureStateRecord", table => table
|
||||
SchemaBuilder.CreateTable("ShellFeatureStateRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<string>("InstallState")
|
||||
@@ -66,8 +65,8 @@ namespace Orchard.Core.Settings {
|
||||
.Column<int>("ShellStateRecord_Id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ShellParameterRecord (Id integer, Component TEXT, Name TEXT, Value TEXT, ShellDescriptorRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ShellParameterRecord", table => table
|
||||
SchemaBuilder.CreateTable("ShellParameterRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Component")
|
||||
.Column<string>("Name")
|
||||
@@ -75,14 +74,14 @@ namespace Orchard.Core.Settings {
|
||||
.Column<int>("ShellDescriptorRecord_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_ShellStateRecord (Id integer, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ShellStateRecord", table => table
|
||||
SchemaBuilder.CreateTable("ShellStateRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Unused")
|
||||
);
|
||||
|
||||
//CREATE TABLE Settings_SiteSettingsRecord (Id INTEGER not null, SiteSalt TEXT, SiteName TEXT, SuperUser TEXT, PageTitleSeparator TEXT, HomePage TEXT, SiteCulture TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("SiteSettingsPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("SiteSettingsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("SiteSalt")
|
||||
.Column<string>("SiteName")
|
||||
@@ -90,16 +89,10 @@ namespace Orchard.Core.Settings {
|
||||
.Column<string>("PageTitleSeparator")
|
||||
.Column<string>("HomePage")
|
||||
.Column<string>("SiteCulture")
|
||||
.Column<string>("ResourceDebugMode", c => c.WithDefault("FromAppSetting"))
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
SchemaBuilder.AlterTable("SiteSettingsPartRecord", table => table
|
||||
.AddColumn("ResourceDebugMode", DbType.String, column => column.WithDefault("FromAppSetting"))
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,17 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using System.Data;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.Blogs {
|
||||
public class Migrations : 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
|
||||
SchemaBuilder.CreateTable("BlogPartArchiveRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("Year")
|
||||
.Column<int>("Month")
|
||||
@@ -19,22 +15,32 @@ namespace Orchard.Blogs {
|
||||
.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
|
||||
SchemaBuilder.CreateTable("BlogPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Description")
|
||||
.Column<string>("Description", c => c.Unlimited())
|
||||
.Column<int>("PostCount")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
SchemaBuilder.CreateTable("RecentBlogPostsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("BlogSlug")
|
||||
.Column<int>("Count")
|
||||
);
|
||||
|
||||
SchemaBuilder.CreateTable("BlogArchivesPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("BlogSlug", c => c.WithLength(255))
|
||||
);
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("Blog",
|
||||
cfg => cfg
|
||||
.WithPart("BlogPart")
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("RoutePart")
|
||||
.WithPart("BlogPagerPart")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("BlogPost",
|
||||
@@ -46,24 +52,6 @@ namespace Orchard.Blogs {
|
||||
.WithPart("BodyPart")
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public int UpdateFrom3() {
|
||||
SchemaBuilder.CreateTable("RecentBlogPostsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("BlogSlug")
|
||||
.Column<int>("Count")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("RecentBlogPosts",
|
||||
cfg => cfg
|
||||
.WithPart("RecentBlogPostsPart")
|
||||
@@ -71,14 +59,6 @@ namespace Orchard.Blogs {
|
||||
.WithPart("WidgetPart")
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int UpdateFrom4() {
|
||||
SchemaBuilder.CreateTable("BlogArchivesPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("BlogSlug", c => c.WithLength(255))
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition("BlogArchives",
|
||||
cfg => cfg
|
||||
@@ -88,21 +68,7 @@ namespace Orchard.Blogs {
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
public int UpdateFrom5() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("Blog",
|
||||
cfg => cfg.WithPart("BlogPagerPart"));
|
||||
return 6;
|
||||
}
|
||||
|
||||
public int UpdateFrom6() {
|
||||
SchemaBuilder.AlterTable("BlogPartRecord", table => table
|
||||
.AlterColumn("Description", c => c.WithType(DbType.String).Unlimited())
|
||||
);
|
||||
|
||||
return 7;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
@@ -11,13 +7,11 @@ namespace Orchard.Comments {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Comments_ClosedCommentsRecord (Id integer, ContentItemId INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ClosedCommentsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("ContentItemId")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Comments_CommentPartRecord (Id INTEGER not null, Author TEXT, SiteName TEXT, UserName TEXT, Email TEXT, Status TEXT, CommentDateUtc DATETIME, CommentText TEXT, CommentedOn INTEGER, CommentedOnContainer INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommentPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Author")
|
||||
@@ -31,7 +25,6 @@ namespace Orchard.Comments {
|
||||
.Column<int>("CommentedOnContainer")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Comments_CommentSettingsPartRecord (Id INTEGER not null, ModerateComments INTEGER, EnableSpamProtection INTEGER, AkismetKey TEXT, AkismetUrl TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommentSettingsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("ModerateComments")
|
||||
@@ -40,17 +33,12 @@ namespace Orchard.Comments {
|
||||
.Column<string>("AkismetUrl")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Comments_CommentsPartRecord (Id INTEGER not null, CommentsShown INTEGER, CommentsActive INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommentsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("CommentsShown")
|
||||
.Column<bool>("CommentsActive")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("Comment",
|
||||
cfg => cfg
|
||||
.WithPart("CommentPart")
|
||||
@@ -62,31 +50,9 @@ namespace Orchard.Comments {
|
||||
.WithPart("CommentsContainerPart")
|
||||
);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(CommentsPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Default", new ContentLocation { Zone = "Primary", Position = "before.5" }},
|
||||
{"Detail", new ContentLocation { Zone = "Primary", Position = "after.5" }},
|
||||
{"SummaryAdmin", new ContentLocation { Zone = "meta", Position = null }},
|
||||
{"Summary", new ContentLocation { Zone = "meta", Position = "5" }},
|
||||
{"Editor", new ContentLocation { Zone = "Primary", Position = "10" }},
|
||||
}));
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(CommentsContainerPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"SummaryAdmin", new ContentLocation { Zone = "meta", Position = null }},
|
||||
{"Summary", new ContentLocation { Zone = "meta", Position = null }},
|
||||
}));
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int UpdateFrom3() {
|
||||
ContentDefinitionManager.AlterPartDefinition("CommentsPart", builder => builder.Attachable());
|
||||
return 4;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,7 +5,8 @@ namespace Orchard.Email {
|
||||
|
||||
public int Create() {
|
||||
|
||||
SchemaBuilder.CreateTable("SmtpSettingsPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("SmtpSettingsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Address")
|
||||
.Column<string>("Host")
|
||||
|
@@ -5,7 +5,8 @@ namespace Orchard.Indexing {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("IndexingTaskRecord", table => table
|
||||
SchemaBuilder.CreateTable("IndexingTaskRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("Action")
|
||||
.Column<DateTime>("CreatedUtc")
|
||||
|
@@ -4,30 +4,30 @@ namespace Orchard.Roles {
|
||||
public class RolesDataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Roles_PermissionRecord (Id integer, Name TEXT, FeatureName TEXT, Description TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("PermissionRecord", table => table
|
||||
SchemaBuilder.CreateTable("PermissionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
.Column<string>("FeatureName")
|
||||
.Column<string>("Description")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Roles_RoleRecord (Id integer, Name TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("RoleRecord", table => table
|
||||
SchemaBuilder.CreateTable("RoleRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Roles_RolesPermissionsRecord (Id integer, Role_id INTEGER, Permission_id INTEGER, RoleRecord_Id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("RolesPermissionsRecord", table => table
|
||||
SchemaBuilder.CreateTable("RolesPermissionsRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("Role_id")
|
||||
.Column<int>("Permission_id")
|
||||
.Column<int>("RoleRecord_Id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Roles_UserRolesRecord (Id integer, UserId INTEGER, Role_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("UserRolesPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("UserRolesPartRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("UserId")
|
||||
.Column<int>("Role_id")
|
||||
|
@@ -9,13 +9,9 @@ namespace Orchard.Search {
|
||||
SchemaBuilder.CreateTable("SearchSettingsPartRecord", table => table
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("FilterCulture")
|
||||
.Column<string>("SearchedFields")
|
||||
.Column<string>("SearchedFields", c => c.Unlimited())
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("SearchForm",
|
||||
cfg => cfg
|
||||
.WithPart("SearchFormPart")
|
||||
@@ -24,7 +20,7 @@ namespace Orchard.Search {
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,42 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Tags.Models;
|
||||
|
||||
namespace Orchard.Tags {
|
||||
public class TagsDataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Tags_Tag (Id integer, TagName TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("Tag", table => table
|
||||
SchemaBuilder.CreateTable("Tag",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("TagName")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Tags_TagsContentItems (Id integer, TagId INTEGER, ContentItemId INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("TagsContentItems", table => table
|
||||
SchemaBuilder.CreateTable("TagsContentItems",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("TagId")
|
||||
.Column<int>("ContentItemId")
|
||||
);
|
||||
|
||||
ContentDefinitionManager.AlterPartDefinition("TagsPart", builder => builder.Attachable());
|
||||
|
||||
return 1;
|
||||
}
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterPartDefinition(typeof(TagsPart).Name, cfg => cfg
|
||||
.WithLocation(new Dictionary<string, ContentLocation> {
|
||||
{"Default", new ContentLocation { Zone = "Primary", Position = "49" }},
|
||||
{"Editor", new ContentLocation { Zone = "Primary", Position = "9" }},
|
||||
}));
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int UpdateFrom2() {
|
||||
ContentDefinitionManager.AlterPartDefinition("TagsPart", builder => builder.Attachable());
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,8 +4,8 @@ namespace Orchard.Themes {
|
||||
public class ThemesDataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Themes_ThemeSiteSettingsRecord (Id INTEGER not null, CurrentThemeName TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ThemeSiteSettingsPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("ThemeSiteSettingsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("CurrentThemeName")
|
||||
);
|
||||
|
@@ -4,8 +4,8 @@ namespace Orchard.Users {
|
||||
public class UsersDataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("UserPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("UserPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("UserName")
|
||||
.Column<string>("Email")
|
||||
@@ -14,21 +14,13 @@ namespace Orchard.Users {
|
||||
.Column<string>("PasswordFormat")
|
||||
.Column<string>("HashAlgorithm")
|
||||
.Column<string>("PasswordSalt")
|
||||
.Column<string>("RegistrationStatus", c => c.WithDefault("Approved"))
|
||||
.Column<string>("EmailStatus", c => c.WithDefault("Approved"))
|
||||
.Column<string>("EmailChallengeToken")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
|
||||
// Adds registration fields to previous versions
|
||||
SchemaBuilder
|
||||
.AlterTable("UserPartRecord", table => table.AddColumn<string>("RegistrationStatus", c => c.WithDefault("Approved")))
|
||||
.AlterTable("UserPartRecord", table => table.AddColumn<string>("EmailStatus", c => c.WithDefault("Approved")))
|
||||
.AlterTable("UserPartRecord", table => table.AddColumn<string>("EmailChallengeToken"));
|
||||
|
||||
// Site Settings record
|
||||
SchemaBuilder.CreateTable("RegistrationSettingsPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("RegistrationSettingsPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("UsersCanRegister", c => c.WithDefault(false))
|
||||
.Column<bool>("UsersMustValidateEmail", c => c.WithDefault(false))
|
||||
@@ -36,7 +28,7 @@ namespace Orchard.Users {
|
||||
.Column<bool>("NotifyModeration", c => c.WithDefault(false))
|
||||
);
|
||||
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Events;
|
||||
using Orchard.Widgets.Models;
|
||||
|
||||
namespace Orchard.Widgets {
|
||||
@@ -32,14 +28,16 @@ namespace Orchard.Widgets {
|
||||
|
||||
public class WidgetsDataMigration : DataMigrationImpl {
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("LayerPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("LayerPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Name")
|
||||
.Column<string>("Description")
|
||||
.Column<string>("LayerRule")
|
||||
.Column<string>("Description", c => c.Unlimited())
|
||||
.Column<string>("LayerRule", c => c.Unlimited())
|
||||
);
|
||||
|
||||
SchemaBuilder.CreateTable("WidgetPartRecord", table => table
|
||||
SchemaBuilder.CreateTable("WidgetPartRecord",
|
||||
table => table
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Title")
|
||||
.Column<string>("Position")
|
||||
@@ -60,10 +58,6 @@ namespace Orchard.Widgets {
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("WidgetPage",
|
||||
cfg => cfg
|
||||
.WithPart("CommonPart")
|
||||
@@ -71,7 +65,8 @@ namespace Orchard.Widgets {
|
||||
.WithPart("WidgetBagPart")
|
||||
.Creatable()
|
||||
);
|
||||
return 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,35 +1,34 @@
|
||||
using System.Data;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.ContentManagement.DataMigrations {
|
||||
public class FrameworkDataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Framework_ContentItemRecord (Id integer, Data TEXT, ContentType_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentItemRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentItemRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Data")
|
||||
.Column<string>("Data", c => c.Unlimited())
|
||||
.Column<int>("ContentType_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Framework_ContentItemVersionRecord (Id integer, Number INTEGER, Published INTEGER, Latest INTEGER, Data TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentItemVersionRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentItemVersionRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<int>("Number")
|
||||
.Column<bool>("Published")
|
||||
.Column<bool>("Latest")
|
||||
.Column<string>("Data")
|
||||
.Column<string>("Data", c => c.Unlimited())
|
||||
.Column<int>("ContentItemRecord_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Framework_ContentTypeRecord (Id integer, Name TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ContentTypeRecord", table => table
|
||||
SchemaBuilder.CreateTable("ContentTypeRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Name")
|
||||
);
|
||||
|
||||
//CREATE TABLE Orchard_Framework_CultureRecord (Id integer, Culture TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CultureRecord", table => table
|
||||
SchemaBuilder.CreateTable("CultureRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("Culture")
|
||||
);
|
||||
@@ -37,12 +36,5 @@ namespace Orchard.ContentManagement.DataMigrations {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int UpdateFrom1() {
|
||||
SchemaBuilder
|
||||
.AlterTable("ContentItemRecord", table => table
|
||||
.AlterColumn("Data", column => column.WithType(DbType.String).Unlimited()));
|
||||
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user