201705161305310_FirstMigration.cs
2.66 KB
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
60
61
namespace Vrh.iScheduler.Report.Lib.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FirstMigration : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.SchedulerReportPackageGroups",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 100),
})
.PrimaryKey(t => t.Id);
CreateTable(
"dbo.SchedulerReportPackages",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(maxLength: 200),
SchedulerReportPackageGroupId = c.Int(nullable: false),
Description = c.String(maxLength: 200),
RoleName = c.String(maxLength: 100),
Active = c.Boolean(nullable: false),
Mark = c.String(maxLength: 100),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.SchedulerReportPackageGroups", t => t.SchedulerReportPackageGroupId, cascadeDelete: true)
.Index(t => t.SchedulerReportPackageGroupId);
CreateTable(
"dbo.SchedulerReportPackageItems",
c => new
{
Id = c.Int(nullable: false, identity: true),
SchedulerReportPackageId = c.Int(nullable: false),
ReportId = c.String(maxLength: 50),
ExportType = c.String(maxLength: 30),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.SchedulerReportPackages", t => t.SchedulerReportPackageId, cascadeDelete: true)
.Index(t => t.SchedulerReportPackageId);
}
public override void Down()
{
DropForeignKey("dbo.SchedulerReportPackageItems", "SchedulerReportPackageId", "dbo.SchedulerReportPackages");
DropForeignKey("dbo.SchedulerReportPackages", "SchedulerReportPackageGroupId", "dbo.SchedulerReportPackageGroups");
DropIndex("dbo.SchedulerReportPackageItems", new[] { "SchedulerReportPackageId" });
DropIndex("dbo.SchedulerReportPackages", new[] { "SchedulerReportPackageGroupId" });
DropTable("dbo.SchedulerReportPackageItems");
DropTable("dbo.SchedulerReportPackages");
DropTable("dbo.SchedulerReportPackageGroups");
}
}
}