-
Notifications
You must be signed in to change notification settings - Fork 3
/
Migrations.cs
55 lines (47 loc) · 2.13 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
52
53
54
55
using System;
using System.Collections.Generic;
using System.Data;
using FlickrGallery.Models;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace FlickrGallery {
public class Migrations : DataMigrationImpl {
public int Create() {
// Creating table FlickrGalleryWidgetRecord
SchemaBuilder.CreateTable("FlickrGalleryWidgetRecord", table => table
.ContentPartRecord()
.Column("MaxImages", DbType.Int32)
.Column("Mode", DbType.Int32)
.Column("GalleryID", DbType.String)
.Column("PhotoSetId", DbType.String)
.Column("GroupId", DbType.String)
.Column("Tags", DbType.String)
.Column("PhotosOfUserId", DbType.String)
.Column("PhotosUploadedByUserId", DbType.String)
);
ContentDefinitionManager.AlterPartDefinition(typeof(FlickrGalleryWidgetPart).Name,
builder => builder.Attachable());
ContentDefinitionManager.AlterTypeDefinition("FlickrGalleryWidget", cfg => cfg
.WithPart("FlickrGalleryWidgetPart")
.WithPart("WidgetPart")
.WithPart("CommonPart")
.WithSetting("Stereotype", "Widget"));
return 1;
}
public int UpdateFrom1()
{
return 2;
}
public int UpdateFrom2()
{
SchemaBuilder.AlterTable("FlickrGalleryWidgetRecord", table => table.AddColumn("DisableModalGallery", DbType.Boolean));
SchemaBuilder.AlterTable("FlickrGalleryWidgetRecord", table => table.AddColumn("DisableLazyLoading", DbType.Boolean));
SchemaBuilder.AlterTable("FlickrGalleryWidgetRecord", table => table.AddColumn("DisableCaching", DbType.Boolean));
SchemaBuilder.AlterTable("FlickrGalleryWidgetRecord", table => table.AddColumn("CacheDuration", DbType.Int32));
return 3;
}
}
}