diff options
| author | transtrike <transtrike@gmail.com> | 2021-02-01 16:03:38 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-02-01 16:03:38 +0200 |
| commit | b41f887712ef8f2f0b602da3042261a78c5f492a (patch) | |
| tree | fb6437ea34896da7c7db3a292bbdb8ee7d14e889 /src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs | |
| parent | aa342542789b22f24ce3ecbfcb7888d4ff12d30c (diff) | |
| download | DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.tar DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.tar.gz DevHive-b41f887712ef8f2f0b602da3042261a78c5f492a.zip | |
Commented out implementation of Rating; Bug fixes
Diffstat (limited to 'src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs')
| -rw-r--r-- | src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs b/src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs new file mode 100644 index 0000000..a5a4a72 --- /dev/null +++ b/src/DevHive.Data/Migrations/20210201110523_Rating_Init_Configuration.cs @@ -0,0 +1,77 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DevHive.Data.Migrations +{ + public partial class Rating_Init_Configuration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Rating_AspNetUsers_UserId", + table: "Rating"); + + migrationBuilder.DropIndex( + name: "IX_Rating_UserId", + table: "Rating"); + + migrationBuilder.DropColumn( + name: "UserId", + table: "Rating"); + + migrationBuilder.CreateTable( + name: "RatedPosts", + columns: table => new + { + UserId = table.Column<Guid>(type: "uuid", nullable: false), + PostId = table.Column<Guid>(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RatedPosts", x => new { x.UserId, x.PostId }); + table.ForeignKey( + name: "FK_RatedPosts_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RatedPosts_Posts_PostId", + column: x => x.PostId, + principalTable: "Posts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_RatedPosts_PostId", + table: "RatedPosts", + column: "PostId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "RatedPosts"); + + migrationBuilder.AddColumn<Guid>( + name: "UserId", + table: "Rating", + type: "uuid", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Rating_UserId", + table: "Rating", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_Rating_AspNetUsers_UserId", + table: "Rating", + column: "UserId", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} |
