Newsbot.Collector/Newsbot.Collector.Database/Migrations/20230729170139_Adding Autho...

67 lines
2.1 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Newsbot.Collector.Database.Migrations
{
/// <inheritdoc />
public partial class AddingAuthorTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "UserId",
table: "DiscordWebhooks",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "Authors",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
SourceId = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Image = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Authors", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_DiscordWebhooks_UserId",
table: "DiscordWebhooks",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_DiscordWebhooks_AspNetUsers_UserId",
table: "DiscordWebhooks",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_DiscordWebhooks_AspNetUsers_UserId",
table: "DiscordWebhooks");
migrationBuilder.DropTable(
name: "Authors");
migrationBuilder.DropIndex(
name: "IX_DiscordWebhooks_UserId",
table: "DiscordWebhooks");
migrationBuilder.DropColumn(
name: "UserId",
table: "DiscordWebhooks");
}
}
}