using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Newsbot.Collector.Database.Migrations
{
///
public partial class AddingAuthorTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "UserId",
table: "DiscordWebhooks",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "Authors",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
SourceId = table.Column(type: "uuid", nullable: false),
Name = table.Column(type: "text", nullable: false),
Image = table.Column(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");
}
///
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");
}
}
}