-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMigrations.cs
51 lines (43 loc) · 1.72 KB
/
Migrations.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace Contrib.FeedMix
{
using Models;
using Orchard.Core.Common.Models;
using Orchard.Widgets.Models;
public class FeedsDataMigration : DataMigrationImpl
{
public int Create()
{
SchemaBuilder.CreateTable("FeedMixPartRecord",
table => table
.ContentPartRecord()
.Column<string>("Title", t => t.NotNull())
.Column<string>("Description")
.Column<string>("Path")
);
SchemaBuilder.CreateTable("FeedPartRecord", table => table
.ContentPartRecord()
.Column<int>("FeedMixPartRecord_Id")
.Column<string>("WebsiteUrl")
.Column<string>("FeedUrl")
.Column<string>("Title")
.Column<string>("Author")
);
SchemaBuilder.CreateTable("FeedMixWidgetPartRecord", table => table
.ContentPartRecord()
.Column<int>("FeedMixPartRecord_Id")
);
ContentDefinitionManager.AlterTypeDefinition("FeedMix", alt => alt.Creatable(false).WithPart("FeedMixPart"));
ContentDefinitionManager.AlterTypeDefinition("Feed", alt => alt.Creatable(false).WithPart("FeedPart"));
ContentDefinitionManager.AlterTypeDefinition(
"FeedMixWidget", cfg => cfg
.WithSetting("Stereotype", "Widget")
.WithPart(typeof(FeedMixWidgetPart).Name)
.WithPart(typeof(CommonPart).Name)
.WithPart(typeof(WidgetPart).Name));
return 1;
}
}
}