71 lines
2.8 KiB
C#
71 lines
2.8 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ReallifeGamemode.Database.Migrations
|
|
{
|
|
public partial class ChatLogs : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ChatLogs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
UserId = table.Column<int>(nullable: true),
|
|
Text = table.Column<string>(nullable: true),
|
|
Time = table.Column<DateTime>(nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Discriminator = table.Column<string>(nullable: false),
|
|
FactionId = table.Column<int>(nullable: true),
|
|
GroupId = table.Column<int>(nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ChatLogs", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_ChatLogs_Users_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "Users",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_ChatLogs_Factions_FactionId",
|
|
column: x => x.FactionId,
|
|
principalTable: "Factions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_ChatLogs_Groups_GroupId",
|
|
column: x => x.GroupId,
|
|
principalTable: "Groups",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ChatLogs_UserId",
|
|
table: "ChatLogs",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ChatLogs_FactionId",
|
|
table: "ChatLogs",
|
|
column: "FactionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_ChatLogs_GroupId",
|
|
table: "ChatLogs",
|
|
column: "GroupId");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ChatLogs");
|
|
}
|
|
}
|
|
}
|