using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWorkHR.Infrastructure.Migrations
{
///
public partial class chatTbls : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "CreateDate",
table: "AspNetUsers",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "UpdateDate",
table: "AspNetUsers",
type: "datetime2",
nullable: true);
migrationBuilder.CreateTable(
name: "ChatMessages",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true),
UpdateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true),
CreateDate = table.Column(type: "datetime2", nullable: false),
UpdateDate = table.Column(type: "datetime2", nullable: true),
SenderId = table.Column(type: "nvarchar(max)", nullable: false),
SenderName = table.Column(type: "nvarchar(max)", nullable: false),
ReceiverId = table.Column(type: "nvarchar(max)", nullable: false),
ReceiverName = table.Column(type: "nvarchar(max)", nullable: false),
Content = table.Column(type: "nvarchar(max)", nullable: false),
IsSeen = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatMessages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ChatAttachment",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true),
UpdateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true),
CreateDate = table.Column(type: "datetime2", nullable: false),
UpdateDate = table.Column(type: "datetime2", nullable: true),
ChatMessageId = table.Column(type: "bigint", nullable: false),
FileName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true),
FilePath = table.Column(type: "nvarchar(max)", nullable: false),
FileType = table.Column(type: "nvarchar(max)", nullable: false),
ContentType = table.Column(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatAttachment", x => x.Id);
table.ForeignKey(
name: "FK_ChatAttachment_ChatMessages_ChatMessageId",
column: x => x.ChatMessageId,
principalTable: "ChatMessages",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
columns: new[] { "CreateDate", "UpdateDate" },
values: new object[] { null, null });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
columns: new[] { "CreateDate", "UpdateDate" },
values: new object[] { null, null });
migrationBuilder.CreateIndex(
name: "IX_ChatAttachment_ChatMessageId",
table: "ChatAttachment",
column: "ChatMessageId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChatAttachment");
migrationBuilder.DropTable(
name: "ChatMessages");
migrationBuilder.DropColumn(
name: "CreateDate",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "UpdateDate",
table: "AspNetUsers");
}
}
}