-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add like (favorite) entity to database
- Loading branch information
Showing
6 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
namespace Friendster.Migrations | ||
{ | ||
public partial class AddLikeEntity : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Likes", | ||
columns: table => new | ||
{ | ||
LikeeId = table.Column<int>(nullable: false), | ||
LikerId = table.Column<int>(nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Likes", x => new { x.LikerId, x.LikeeId }); | ||
table.ForeignKey( | ||
name: "FK_Likes_Users_LikeeId", | ||
column: x => x.LikeeId, | ||
principalTable: "Users", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
table.ForeignKey( | ||
name: "FK_Likes_Users_LikerId", | ||
column: x => x.LikerId, | ||
principalTable: "Users", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Likes_LikeeId", | ||
table: "Likes", | ||
column: "LikeeId"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Likes"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Friendster.Models | ||
{ | ||
public class Like | ||
{ | ||
public int LikeeId { get; set; } | ||
public int LikerId { get; set; } | ||
public User Liker { get; set; } | ||
public User Likee { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters