159 lines
7.5 KiB
C#
159 lines
7.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Marco.Pms.DataAccess.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Added_JobAttendance_Related_Table : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "JobAttendance",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
JobTcketId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
Action = table.Column<int>(type: "int", nullable: false),
|
|
EmployeeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
TaggedInTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
TaggedOutTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
TaggedInAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
TaggedOutAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobAttendance", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendance_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendance_JobTickets_JobTcketId",
|
|
column: x => x.JobTcketId,
|
|
principalTable: "JobTickets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendance_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobAttendanceLogs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
JobAttendanceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
JobTcketId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DocumentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
|
Latitude = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Longitude = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Action = table.Column<int>(type: "int", nullable: false),
|
|
Comment = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
EmployeeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
MarkedTIme = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
MarkedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_JobAttendanceLogs", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendanceLogs_Documents_DocumentId",
|
|
column: x => x.DocumentId,
|
|
principalTable: "Documents",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendanceLogs_Employees_EmployeeId",
|
|
column: x => x.EmployeeId,
|
|
principalTable: "Employees",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendanceLogs_JobAttendance_JobAttendanceId",
|
|
column: x => x.JobAttendanceId,
|
|
principalTable: "JobAttendance",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendanceLogs_JobTickets_JobTcketId",
|
|
column: x => x.JobTcketId,
|
|
principalTable: "JobTickets",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_JobAttendanceLogs_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendance_EmployeeId",
|
|
table: "JobAttendance",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendance_JobTcketId",
|
|
table: "JobAttendance",
|
|
column: "JobTcketId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendance_TenantId",
|
|
table: "JobAttendance",
|
|
column: "TenantId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendanceLogs_DocumentId",
|
|
table: "JobAttendanceLogs",
|
|
column: "DocumentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendanceLogs_EmployeeId",
|
|
table: "JobAttendanceLogs",
|
|
column: "EmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendanceLogs_JobAttendanceId",
|
|
table: "JobAttendanceLogs",
|
|
column: "JobAttendanceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendanceLogs_JobTcketId",
|
|
table: "JobAttendanceLogs",
|
|
column: "JobTcketId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobAttendanceLogs_TenantId",
|
|
table: "JobAttendanceLogs",
|
|
column: "TenantId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "JobAttendanceLogs");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobAttendance");
|
|
}
|
|
}
|
|
}
|