aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-01-31 12:58:44 +0200
committertranstrike <transtrike@gmail.com>2021-01-31 12:58:44 +0200
commit979a86a14cd658b5346279901ac8bca667c373d3 (patch)
tree9791cf02c0838a4d6392e3651f93eeed283acb57 /src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs
parent9d5f4628a3a75871b47ac6a9f9c0419748d9dfb8 (diff)
parentb8743cfdd0515e4d07ea5c926be1d9ade5340a91 (diff)
downloadDevHive-979a86a14cd658b5346279901ac8bca667c373d3.tar
DevHive-979a86a14cd658b5346279901ac8bca667c373d3.tar.gz
DevHive-979a86a14cd658b5346279901ac8bca667c373d3.zip
Username added to JWT; Promotion to Admin fixed
Diffstat (limited to 'src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs')
-rw-r--r--src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs145
1 files changed, 145 insertions, 0 deletions
diff --git a/src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs b/src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs
new file mode 100644
index 0000000..f691c9b
--- /dev/null
+++ b/src/DevHive.Data/Migrations/20210130092813_CloudinaryFileUpload.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace DevHive.Data.Migrations
+{
+ public partial class CloudinaryFileUpload : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Comments_Posts_PostId",
+ table: "Comments");
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "CreatorId",
+ table: "Posts",
+ type: "uuid",
+ nullable: true,
+ oldClrType: typeof(Guid),
+ oldType: "uuid");
+
+ migrationBuilder.AddColumn<List<string>>(
+ name: "FileUrls",
+ table: "Posts",
+ type: "text[]",
+ nullable: true);
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "PostId",
+ table: "Comments",
+ type: "uuid",
+ nullable: true,
+ oldClrType: typeof(Guid),
+ oldType: "uuid");
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "CreatorId",
+ table: "Comments",
+ type: "uuid",
+ nullable: true,
+ oldClrType: typeof(Guid),
+ oldType: "uuid");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Posts_CreatorId",
+ table: "Posts",
+ column: "CreatorId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Comments_CreatorId",
+ table: "Comments",
+ column: "CreatorId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Comments_AspNetUsers_CreatorId",
+ table: "Comments",
+ column: "CreatorId",
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Comments_Posts_PostId",
+ table: "Comments",
+ column: "PostId",
+ principalTable: "Posts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Posts_AspNetUsers_CreatorId",
+ table: "Posts",
+ column: "CreatorId",
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Comments_AspNetUsers_CreatorId",
+ table: "Comments");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Comments_Posts_PostId",
+ table: "Comments");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Posts_AspNetUsers_CreatorId",
+ table: "Posts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Posts_CreatorId",
+ table: "Posts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Comments_CreatorId",
+ table: "Comments");
+
+ migrationBuilder.DropColumn(
+ name: "FileUrls",
+ table: "Posts");
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "CreatorId",
+ table: "Posts",
+ type: "uuid",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "PostId",
+ table: "Comments",
+ type: "uuid",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn<Guid>(
+ name: "CreatorId",
+ table: "Comments",
+ type: "uuid",
+ nullable: false,
+ defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
+ oldClrType: typeof(Guid),
+ oldType: "uuid",
+ oldNullable: true);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Comments_Posts_PostId",
+ table: "Comments",
+ column: "PostId",
+ principalTable: "Posts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+ }
+}