-
Notifications
You must be signed in to change notification settings - Fork 0
/
Migrations.cs
59 lines (52 loc) · 2.04 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
56
57
58
59
using System;
using System.Collections.Generic;
using System.Data;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace EM.TimeTracking {
public class Migrations : DataMigrationImpl {
public int Create() {
SchemaBuilder.CreateTable("MainTypeRecord", table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column("Title", DbType.String)
);
SchemaBuilder.CreateTable("MainRecord", table => table
.ContentPartRecord()
.Column<int>("ParentId")
.Column("Title", DbType.String)
.Column<int>("MainTypeRecord_Id")
)
.CreateForeignKey(
"FK_EM_TimeTracking_MainTypeRecord",
"EM.TimeTracking", "MainRecord",
new[] { "MainTypeRecord_Id" },
"EM.TimeTracking", "MainTypeRecord",
new[] { "Id" }
)
.CreateForeignKey(
"FK_EM_TimeTracking_MainRecordParentChild",
"EM.TimeTracking", "MainRecord",
new[] { "ParentId" },
"EM.TimeTracking", "MainRecord",
new[] { "Id" }
); ;
SchemaBuilder.CreateTable("TimeRegistrationRecord", table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<int>("MainId")
.Column("Date", DbType.Date)
.Column("Value", DbType.Decimal)
)
.CreateForeignKey(
"FK_EM_MainRecord",
"EM.TimeTracking", "TimeRegistrationRecord",
new[] { "MainId" },
"EM.TimeTracking", "MainRecord",
new[] { "Id" }
);
return 1;
}
}
}