83 lines
3.2 KiB
C#
83 lines
3.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Newsbot.Collector.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class SourcesRenamed : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Subscriptions");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DiscordNotification",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CodeAllowReleases = table.Column<bool>(type: "boolean", nullable: false),
|
|
CodeAllowCommits = table.Column<bool>(type: "boolean", nullable: false),
|
|
SourceId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DiscordWebHookId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DiscordNotification", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserSourceSubscription",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
SourceId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
DateAdded = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
UserId = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserSourceSubscription", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserSourceSubscription_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserSourceSubscription_UserId",
|
|
table: "UserSourceSubscription",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DiscordNotification");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "UserSourceSubscription");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Subscriptions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
CodeAllowCommits = table.Column<bool>(type: "boolean", nullable: false),
|
|
CodeAllowReleases = table.Column<bool>(type: "boolean", nullable: false),
|
|
DiscordWebHookId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
SourceId = table.Column<Guid>(type: "uuid", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Subscriptions", x => x.Id);
|
|
});
|
|
}
|
|
}
|
|
}
|