marco.pms.api/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.cs

209 lines
9.0 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class attendancemodule : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AttendanceLogs");
migrationBuilder.CreateTable(
name: "AttendLogs",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Comment = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AttendanceId = table.Column<int>(type: "int", nullable: false),
EmployeeID = table.Column<int>(type: "int", nullable: false),
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
Activity = table.Column<int>(type: "int", nullable: false),
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
Latitude = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Longitude = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpdatedBy = table.Column<int>(type: "int", nullable: true),
TenantId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AttendLogs", x => x.Id);
table.ForeignKey(
name: "FK_AttendLogs_Attendances_AttendanceId",
column: x => x.AttendanceId,
principalTable: "Attendances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttendLogs_Employees_EmployeeID",
column: x => x.EmployeeID,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttendLogs_Employees_UpdatedBy",
column: x => x.UpdatedBy,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_AttendLogs_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 1,
column: "Key",
value: "04db13e4-201a-44ba-9d9a-6c07f91d3cd0");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 2,
column: "Key",
value: "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 3,
column: "Key",
value: "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf");
migrationBuilder.CreateIndex(
name: "IX_AttendLogs_AttendanceId",
table: "AttendLogs",
column: "AttendanceId");
migrationBuilder.CreateIndex(
name: "IX_AttendLogs_EmployeeID",
table: "AttendLogs",
column: "EmployeeID");
migrationBuilder.CreateIndex(
name: "IX_AttendLogs_TenantId",
table: "AttendLogs",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_AttendLogs_UpdatedBy",
table: "AttendLogs",
column: "UpdatedBy");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AttendLogs");
migrationBuilder.CreateTable(
name: "AttendanceLogs",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AttendanceId = table.Column<int>(type: "int", nullable: false),
EmployeeID = table.Column<int>(type: "int", nullable: false),
TenantId = table.Column<int>(type: "int", nullable: false),
UpdatedBy = table.Column<int>(type: "int", nullable: true),
Activity = table.Column<int>(type: "int", nullable: false),
ActivityTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
Comment = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Latitude = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Longitude = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Photo = table.Column<byte[]>(type: "longblob", nullable: true),
UpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AttendanceLogs", x => x.Id);
table.ForeignKey(
name: "FK_AttendanceLogs_Attendances_AttendanceId",
column: x => x.AttendanceId,
principalTable: "Attendances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttendanceLogs_Employees_EmployeeID",
column: x => x.EmployeeID,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttendanceLogs_Employees_UpdatedBy",
column: x => x.UpdatedBy,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_AttendanceLogs_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 1,
column: "Key",
value: "9a70d253-1f44-411c-899a-718c344c1aea");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 2,
column: "Key",
value: "aff7e2a1-8b98-49ca-a73e-b342a4d7ef90");
migrationBuilder.UpdateData(
table: "Modules",
keyColumn: "Id",
keyValue: 3,
column: "Key",
value: "dc33f0de-5730-40b0-b52b-c61ea0176c03");
migrationBuilder.CreateIndex(
name: "IX_AttendanceLogs_AttendanceId",
table: "AttendanceLogs",
column: "AttendanceId");
migrationBuilder.CreateIndex(
name: "IX_AttendanceLogs_EmployeeID",
table: "AttendanceLogs",
column: "EmployeeID");
migrationBuilder.CreateIndex(
name: "IX_AttendanceLogs_TenantId",
table: "AttendanceLogs",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_AttendanceLogs_UpdatedBy",
table: "AttendanceLogs",
column: "UpdatedBy");
}
}
}