1202 lines
41 KiB
C#
1202 lines
41 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using App.Infrastructure.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace App.Infrastructure.Data.Migrations
|
|
{
|
|
[DbContext(typeof(GmaoDbContext))]
|
|
[Migration("20260910115542_InitialCreate")]
|
|
partial class InitialCreate
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.MachinePart", b =>
|
|
{
|
|
b.Property<int>("MachineId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("PartId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("MachineId", "PartId");
|
|
|
|
b.HasIndex("PartId");
|
|
|
|
b.ToTable("MachineParts");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.Part", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("AlertThreshold")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<string>("Designation")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Location")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("PhotoAttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("PrimarySupplierId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("QuantityInStock")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<string>("Reference")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<decimal>("UnitPrice")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PrimarySupplierId");
|
|
|
|
b.HasIndex("Reference")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Parts");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.StockMovement", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("CreatedByUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("MovementType")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("PartId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("Quantity")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<string>("Reason")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("SupplierInvoiceId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("WorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PartId", "CreatedAtUtc");
|
|
|
|
b.ToTable("StockMovements");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.Supplier", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Address")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("ContactName")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Email")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Phone")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Suppliers");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Invoicing.Invoice", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("ClientAddress")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("ClientName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("CreatedByUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("DocumentType")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateOnly?>("DueDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateOnly>("IssueDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("LinkedWorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Number")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("PdfAttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<decimal>("TotalHT")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<decimal>("TotalTTC")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<decimal>("VatRate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Number")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Invoices");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Invoicing.InvoiceLine", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Designation")
|
|
.IsRequired()
|
|
.HasMaxLength(300)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("InvoiceId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("Quantity")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<decimal>("UnitPrice")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<decimal?>("VatRateOverride")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("InvoiceId");
|
|
|
|
b.ToTable("InvoiceLines");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Invoicing.SupplierInvoice", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<decimal>("Amount")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("AttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime>("ImportedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateOnly>("InvoiceDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("InvoiceNumber")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("LinkedWorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("SupplierId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("SupplierInvoices");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Licensing.LicenseActivationCache", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("CompanyName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateOnly>("IssuedDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("MaxMachines")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("MaxUsers")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("LicenseActivationCaches");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Machines.Machine", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateOnly?>("CommissioningDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Criticality")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Designation")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Location")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("PhotoAttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Reference")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("UpdatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Reference")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Machines");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Machines.MachineCounterReading", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("CounterType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("MachineId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime>("RecordedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Source")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("Value")
|
|
.HasColumnType("REAL");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MachineId", "CounterType", "RecordedAtUtc");
|
|
|
|
b.ToTable("MachineCounterReadings");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double?>("CounterThreshold")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<string>("CounterType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("CustomIntervalDays")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("DayOfMonth")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("DayOfWeek")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Description")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("FrequencyType")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double?>("LastExecutionCounterValue")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<DateOnly?>("LastExecutionDateUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("LeadTimeDays")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double?>("LeadTimePercentForCounter")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<int>("MachineId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("MonthlyRuleOccurrence")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("MonthlyRuleWeekday")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("RequiredQualificationTypeId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateOnly>("StartDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MachineId", "IsActive");
|
|
|
|
b.ToTable("MaintenancePlans");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Description")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("EstimatedDurationMinutes")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Label")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("MaintenancePlanId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Order")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MaintenancePlanId");
|
|
|
|
b.ToTable("MaintenanceTasks");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTaskPart", b =>
|
|
{
|
|
b.Property<int>("MaintenanceTaskId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("PartId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("QuantityRequired")
|
|
.HasColumnType("REAL");
|
|
|
|
b.HasKey("MaintenanceTaskId", "PartId");
|
|
|
|
b.HasIndex("PartId");
|
|
|
|
b.ToTable("MaintenanceTaskParts");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.Tool", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Tools");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("AssignedTechnicianUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Comment")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime?>("CompletedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateOnly?>("DueDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("GeneratedForOccurrenceKey")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("MachineId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("MaintenancePlanId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Priority")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateOnly>("ScheduledDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Source")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AssignedTechnicianUserId");
|
|
|
|
b.HasIndex("MachineId");
|
|
|
|
b.HasIndex("MaintenancePlanId", "GeneratedForOccurrenceKey")
|
|
.IsUnique()
|
|
.HasFilter("MaintenancePlanId IS NOT NULL");
|
|
|
|
b.HasIndex("Status", "ScheduledDate");
|
|
|
|
b.ToTable("WorkOrders");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderPartUsed", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("PartId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<double>("QuantityUsed")
|
|
.HasColumnType("REAL");
|
|
|
|
b.Property<int?>("StockMovementId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("WorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("PartId");
|
|
|
|
b.HasIndex("WorkOrderId");
|
|
|
|
b.ToTable("WorkOrderPartsUsed");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderTaskResult", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Comment")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime?>("CompletedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("CompletedByTechnicianUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<bool>("IsCompleted")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("MaintenanceTaskId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("PhotoAttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("WorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("MaintenanceTaskId");
|
|
|
|
b.HasIndex("WorkOrderId");
|
|
|
|
b.ToTable("WorkOrderTaskResults");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Shared.AppSetting", b =>
|
|
{
|
|
b.Property<string>("Key")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Value")
|
|
.IsRequired()
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Key");
|
|
|
|
b.ToTable("AppSettings");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Shared.Attachment", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("EntityId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("EntityType")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("FileName")
|
|
.IsRequired()
|
|
.HasMaxLength(260)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<long>("SizeBytes")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("StoredRelativePath")
|
|
.IsRequired()
|
|
.HasMaxLength(400)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("UploadedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("UploadedByUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("EntityType", "EntityId");
|
|
|
|
b.ToTable("Attachments");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Sync.SyncDevice", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("DeviceIdentifier")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DeviceName")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime?>("LastSyncAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("PairedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("PairingPinHash")
|
|
.IsRequired()
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeviceIdentifier")
|
|
.IsUnique();
|
|
|
|
b.ToTable("SyncDevices");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Sync.SyncLogEntry", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Direction")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("EntityType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("ErrorMessage")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("OccurredAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("SyncDeviceId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("SyncDeviceId");
|
|
|
|
b.ToTable("SyncLogEntries");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.QualificationType", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("Category")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Label")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Code")
|
|
.IsUnique();
|
|
|
|
b.ToTable("QualificationTypes");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
|
|
{
|
|
b.Property<int>("UserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("PhoneNumber")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Skills")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("UserId");
|
|
|
|
b.ToTable("TechnicianProfiles");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TechnicianQualification", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int?>("CertificateAttachmentId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateOnly?>("ExpiryDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateOnly>("ObtainedDate")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("QualificationTypeId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("TechnicianUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("QualificationTypeId");
|
|
|
|
b.HasIndex("TechnicianUserId", "ExpiryDate");
|
|
|
|
b.ToTable("TechnicianQualifications");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TimeEntry", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Comment")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("DurationMinutes")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime?>("EndedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Source")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime>("StartedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("SyncDeviceId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("TechnicianUserId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("WorkOrderId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("WorkOrderId");
|
|
|
|
b.ToTable("TimeEntries");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.User", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Email")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("FullName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<DateTime?>("LastLoginAtUtc")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.IsRequired()
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("Role")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("Username")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Username")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Users");
|
|
});
|
|
|
|
modelBuilder.Entity("MaintenanceTaskTool", b =>
|
|
{
|
|
b.Property<int>("MaintenanceTaskId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<int>("ToolsId")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.HasKey("MaintenanceTaskId", "ToolsId");
|
|
|
|
b.HasIndex("ToolsId");
|
|
|
|
b.ToTable("MaintenanceTaskTools", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.MachinePart", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
|
|
.WithMany("MachineParts")
|
|
.HasForeignKey("MachineId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
|
|
.WithMany()
|
|
.HasForeignKey("PartId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Machine");
|
|
|
|
b.Navigation("Part");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.Part", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Inventory.Supplier", "PrimarySupplier")
|
|
.WithMany()
|
|
.HasForeignKey("PrimarySupplierId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.Navigation("PrimarySupplier");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Inventory.StockMovement", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
|
|
.WithMany()
|
|
.HasForeignKey("PartId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Part");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Invoicing.InvoiceLine", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Invoicing.Invoice", null)
|
|
.WithMany("Lines")
|
|
.HasForeignKey("InvoiceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Machines.MachineCounterReading", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
|
|
.WithMany("CounterReadings")
|
|
.HasForeignKey("MachineId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Machine");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
|
|
.WithMany("MaintenancePlans")
|
|
.HasForeignKey("MachineId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Machine");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Maintenance.MaintenancePlan", "MaintenancePlan")
|
|
.WithMany("Tasks")
|
|
.HasForeignKey("MaintenancePlanId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("MaintenancePlan");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTaskPart", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
|
|
.WithMany("RequiredParts")
|
|
.HasForeignKey("MaintenanceTaskId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
|
|
.WithMany()
|
|
.HasForeignKey("PartId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Part");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Team.User", null)
|
|
.WithMany()
|
|
.HasForeignKey("AssignedTechnicianUserId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
|
|
.WithMany("WorkOrders")
|
|
.HasForeignKey("MachineId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Maintenance.MaintenancePlan", "MaintenancePlan")
|
|
.WithMany("WorkOrders")
|
|
.HasForeignKey("MaintenancePlanId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.Navigation("Machine");
|
|
|
|
b.Navigation("MaintenancePlan");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderPartUsed", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Inventory.Part", null)
|
|
.WithMany()
|
|
.HasForeignKey("PartId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", null)
|
|
.WithMany("PartsUsed")
|
|
.HasForeignKey("WorkOrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderTaskResult", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
|
|
.WithMany()
|
|
.HasForeignKey("MaintenanceTaskId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", "WorkOrder")
|
|
.WithMany("TaskResults")
|
|
.HasForeignKey("WorkOrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("WorkOrder");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Sync.SyncLogEntry", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Sync.SyncDevice", null)
|
|
.WithMany()
|
|
.HasForeignKey("SyncDeviceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Team.User", "User")
|
|
.WithOne("TechnicianProfile")
|
|
.HasForeignKey("App.Core.Entities.Team.TechnicianProfile", "UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TechnicianQualification", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Team.QualificationType", "QualificationType")
|
|
.WithMany()
|
|
.HasForeignKey("QualificationTypeId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Team.TechnicianProfile", "Technician")
|
|
.WithMany("Qualifications")
|
|
.HasForeignKey("TechnicianUserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("QualificationType");
|
|
|
|
b.Navigation("Technician");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TimeEntry", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", "WorkOrder")
|
|
.WithMany()
|
|
.HasForeignKey("WorkOrderId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("WorkOrder");
|
|
});
|
|
|
|
modelBuilder.Entity("MaintenanceTaskTool", b =>
|
|
{
|
|
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
|
|
.WithMany()
|
|
.HasForeignKey("MaintenanceTaskId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("App.Core.Entities.Maintenance.Tool", null)
|
|
.WithMany()
|
|
.HasForeignKey("ToolsId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Invoicing.Invoice", b =>
|
|
{
|
|
b.Navigation("Lines");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Machines.Machine", b =>
|
|
{
|
|
b.Navigation("CounterReadings");
|
|
|
|
b.Navigation("MachineParts");
|
|
|
|
b.Navigation("MaintenancePlans");
|
|
|
|
b.Navigation("WorkOrders");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
|
|
{
|
|
b.Navigation("Tasks");
|
|
|
|
b.Navigation("WorkOrders");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
|
|
{
|
|
b.Navigation("RequiredParts");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
|
|
{
|
|
b.Navigation("PartsUsed");
|
|
|
|
b.Navigation("TaskResults");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
|
|
{
|
|
b.Navigation("Qualifications");
|
|
});
|
|
|
|
modelBuilder.Entity("App.Core.Entities.Team.User", b =>
|
|
{
|
|
b.Navigation("TechnicianProfile");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|