using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LANCommander.Migrations
{
///
public partial class AddPlaySessions : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PlaySessions",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
GameId = table.Column(type: "TEXT", nullable: false),
UserId = table.Column(type: "TEXT", nullable: false),
Start = table.Column(type: "TEXT", nullable: true),
End = table.Column(type: "TEXT", nullable: true),
CreatedOn = table.Column(type: "TEXT", nullable: false),
CreatedById = table.Column(type: "TEXT", nullable: true),
UpdatedOn = table.Column(type: "TEXT", nullable: false),
UpdatedById = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PlaySessions", x => x.Id);
table.ForeignKey(
name: "FK_PlaySessions_AspNetUsers_CreatedById",
column: x => x.CreatedById,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PlaySessions_AspNetUsers_UpdatedById",
column: x => x.UpdatedById,
principalTable: "AspNetUsers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_PlaySessions_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlaySessions_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_PlaySessions_CreatedById",
table: "PlaySessions",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_PlaySessions_GameId",
table: "PlaySessions",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_PlaySessions_UpdatedById",
table: "PlaySessions",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_PlaySessions_UserId",
table: "PlaySessions",
column: "UserId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PlaySessions");
}
}
}