123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace MTWorkHR.Infrastructure.Migrations
- {
- /// <inheritdoc />
- public partial class chatTbls : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<DateTime>(
- name: "CreateDate",
- table: "AspNetUsers",
- type: "datetime2",
- nullable: true);
- migrationBuilder.AddColumn<DateTime>(
- name: "UpdateDate",
- table: "AspNetUsers",
- type: "datetime2",
- nullable: true);
- migrationBuilder.CreateTable(
- name: "ChatMessages",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- SenderId = table.Column<string>(type: "nvarchar(max)", nullable: false),
- SenderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ReceiverId = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ReceiverName = table.Column<string>(type: "nvarchar(max)", nullable: false),
- Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
- IsSeen = table.Column<bool>(type: "bit", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ChatMessages", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "ChatAttachment",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- ChatMessageId = table.Column<long>(type: "bigint", nullable: false),
- FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
- FilePath = table.Column<string>(type: "nvarchar(max)", nullable: false),
- FileType = table.Column<string>(type: "nvarchar(max)", nullable: false),
- ContentType = table.Column<string>(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");
- }
- /// <inheritdoc />
- 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");
- }
- }
- }
|