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 Project_Unite.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class votingsystemforums : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.ForumPostEdits",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
UserId = c.String(),
EditReason = c.String(),
PreviousState = c.String(),
EditedAt = c.DateTime(nullable: false),
ForumPost_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPosts", t => t.ForumPost_Id)
.Index(t => t.ForumPost_Id);
CreateTable(
"dbo.Likes",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Post_Id = c.String(maxLength: 128),
User_Id = c.String(maxLength: 128),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.ForumPosts", t => t.Post_Id)
.ForeignKey("dbo.AspNetUsers", t => t.User_Id)
.Index(t => t.Post_Id)
.Index(t => t.User_Id);
AddColumn("dbo.ForumTopics", "Votes", c => c.Int(nullable: false));
AddColumn("dbo.ForumTopics", "StartedAt", c => c.DateTime(nullable: false));
AddColumn("dbo.ForumPosts", "PostedAt", c => c.DateTime(nullable: false));
AddColumn("dbo.AspNetRoles", "CanDeleteForumCategories", c => c.Boolean());
}
public override void Down()
{
DropForeignKey("dbo.Likes", "User_Id", "dbo.AspNetUsers");
DropForeignKey("dbo.Likes", "Post_Id", "dbo.ForumPosts");
DropForeignKey("dbo.ForumPostEdits", "ForumPost_Id", "dbo.ForumPosts");
DropIndex("dbo.Likes", new[] { "User_Id" });
DropIndex("dbo.Likes", new[] { "Post_Id" });
DropIndex("dbo.ForumPostEdits", new[] { "ForumPost_Id" });
DropColumn("dbo.AspNetRoles", "CanDeleteForumCategories");
DropColumn("dbo.ForumPosts", "PostedAt");
DropColumn("dbo.ForumTopics", "StartedAt");
DropColumn("dbo.ForumTopics", "Votes");
DropTable("dbo.Likes");
DropTable("dbo.ForumPostEdits");
}
}
}
|