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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
namespace Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class forum_backend_base : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ForumCategories",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
ParentId = c.String(),
LinkUrl = c.String(),
ForumCategory_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumCategories", t => t.ForumCategory_Id)
.Index(t => t.ForumCategory_Id);
CreateTable(
"dbo.ForumPollOptions",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
PollId = c.String(),
Name = c.String(),
ForumPoll_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPolls", t => t.ForumPoll_Id)
.Index(t => t.ForumPoll_Id);
CreateTable(
"dbo.ForumPollVotes",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
PollOptionId = c.String(),
UserId = c.String(),
ForumPollOption_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPollOptions", t => t.ForumPollOption_Id)
.Index(t => t.ForumPollOption_Id);
CreateTable(
"dbo.ForumPolls",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Description = c.String(),
TopicId = c.String(),
IsActive = c.Boolean(nullable: false),
AllowMultivote = c.Boolean(nullable: false),
AllowVoteChanges = c.Boolean(nullable: false),
})
.PrimaryKey(t => t.Id);
CreateTable(
"dbo.ForumPosts",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
AuthorId = c.String(),
TopicId = c.String(),
Body = c.String(),
ForumTopic_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumTopics", t => t.ForumTopic_Id)
.Index(t => t.ForumTopic_Id);
CreateTable(
"dbo.ForumTopics",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Subject = c.String(),
AuthorId = c.String(),
CategoryId = c.String(),
IsSticky = c.Boolean(nullable: false),
IsAnnounce = c.Boolean(nullable: false),
IsUnlisted = c.Boolean(nullable: false),
IsGlobal = c.Boolean(nullable: false),
PollId = c.String(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropForeignKey("dbo.ForumPosts", "ForumTopic_Id", "dbo.ForumTopics");
DropForeignKey("dbo.ForumPollOptions", "ForumPoll_Id", "dbo.ForumPolls");
DropForeignKey("dbo.ForumPollVotes", "ForumPollOption_Id", "dbo.ForumPollOptions");
DropForeignKey("dbo.ForumCategories", "ForumCategory_Id", "dbo.ForumCategories");
DropIndex("dbo.ForumPosts", new[] { "ForumTopic_Id" });
DropIndex("dbo.ForumPollVotes", new[] { "ForumPollOption_Id" });
DropIndex("dbo.ForumPollOptions", new[] { "ForumPoll_Id" });
DropIndex("dbo.ForumCategories", new[] { "ForumCategory_Id" });
DropTable("dbo.ForumTopics");
DropTable("dbo.ForumPosts");
DropTable("dbo.ForumPolls");
DropTable("dbo.ForumPollVotes");
DropTable("dbo.ForumPollOptions");
DropTable("dbo.ForumCategories");
}
}
}
|