using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DorkNet.Server.Migrations
{
///
public partial class Phase15Photos : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Cheers_FromPlayerId_TargetPlayerId_TargetRoomId_Type",
table: "Cheers");
migrationBuilder.AddColumn(
name: "TargetPhotoId",
table: "Cheers",
type: "INTEGER",
nullable: false,
defaultValue: 0L);
migrationBuilder.CreateTable(
name: "Photos",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UploaderPlayerId = table.Column(type: "INTEGER", nullable: false),
BlobName = table.Column(type: "TEXT", maxLength: 256, nullable: false),
Caption = table.Column(type: "TEXT", maxLength: 2048, nullable: false),
RoomId = table.Column(type: "INTEGER", nullable: false),
TaggedPlayerIdsCsv = table.Column(type: "TEXT", maxLength: 2048, nullable: false),
IsPublic = table.Column(type: "INTEGER", nullable: false),
CreatedAt = table.Column(type: "TEXT", nullable: false),
DeletedAt = table.Column(type: "TEXT", nullable: true),
CheerCount = table.Column(type: "INTEGER", nullable: false),
ViewCount = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Photos", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Cheers_FromPlayerId_TargetPlayerId_TargetRoomId_TargetPhotoId_Type",
table: "Cheers",
columns: new[] { "FromPlayerId", "TargetPlayerId", "TargetRoomId", "TargetPhotoId", "Type" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Cheers_TargetPhotoId",
table: "Cheers",
column: "TargetPhotoId");
migrationBuilder.CreateIndex(
name: "IX_Photos_BlobName",
table: "Photos",
column: "BlobName");
migrationBuilder.CreateIndex(
name: "IX_Photos_CreatedAt",
table: "Photos",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Photos_RoomId",
table: "Photos",
column: "RoomId");
migrationBuilder.CreateIndex(
name: "IX_Photos_UploaderPlayerId",
table: "Photos",
column: "UploaderPlayerId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Photos");
migrationBuilder.DropIndex(
name: "IX_Cheers_FromPlayerId_TargetPlayerId_TargetRoomId_TargetPhotoId_Type",
table: "Cheers");
migrationBuilder.DropIndex(
name: "IX_Cheers_TargetPhotoId",
table: "Cheers");
migrationBuilder.DropColumn(
name: "TargetPhotoId",
table: "Cheers");
migrationBuilder.CreateIndex(
name: "IX_Cheers_FromPlayerId_TargetPlayerId_TargetRoomId_Type",
table: "Cheers",
columns: new[] { "FromPlayerId", "TargetPlayerId", "TargetRoomId", "Type" },
unique: true);
}
}
}