Release 1.1.0: QR-Reportimport, Regal-Auswahlmodal, Einlagern/Auslagern-Verknuepfungen aus Reifenlager, Stabilitaetsfixes
This commit is contained in:
1 parent
cba9414e92
commit
3404fb9875
25 files changed
+5106
-744
No files matched your search
@@ -123,10 +123,7 @@ public class DatabaseInitializer : IDatabaseInitializer
|
||||
?? throw new InvalidOperationException("Connection string nicht gefunden.");
|
||||
|
||||
await using var connection = new MySqlConnection(connectionString);
|
||||
|
||||
// Set connection timeout
|
||||
connection.ConnectionTimeout.ToString();
|
||||
|
||||
|
||||
await connection.OpenAsync(cancellationToken);
|
||||
|
||||
// Core tables
|
||||
@@ -141,6 +138,7 @@ public class DatabaseInitializer : IDatabaseInitializer
|
||||
await ExecuteSqlSafeAsync(connection, CreateStorageLocationsTableSql, "StorageLocations", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection, CreateTireStacksTableSql, "TireStacks", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection, CreateTireItemsTableSql, "TireItems", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection, CreateTireInspectionsTableSql, "TireInspections", cancellationToken);
|
||||
|
||||
// Kanban tables
|
||||
await ExecuteSqlSafeAsync(connection, CreateKanbanColumnsTableSql, "KanbanColumns", cancellationToken);
|
||||
@@ -205,6 +203,27 @@ public class DatabaseInitializer : IDatabaseInitializer
|
||||
"ALTER TABLE `Customers` MODIFY COLUMN `FirstName` VARCHAR(100) NULL;",
|
||||
"MakeCustomerFirstNameNullable", cancellationToken);
|
||||
|
||||
// Data repair: backfill NULLs in columns mapped as non-nullable strings
|
||||
// (prevents InvalidCastException: DBNull -> String when materializing entities)
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"UPDATE `Customers` SET `LastName` = '-' WHERE `LastName` IS NULL;",
|
||||
"BackfillCustomerLastName", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"UPDATE `Customers` SET `CustomerNumber` = CONCAT('AUTO-', SUBSTRING(REPLACE(`Id`, '-', ''), 1, 12)) WHERE `CustomerNumber` IS NULL;",
|
||||
"BackfillCustomerNumber", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"ALTER TABLE `Customers` MODIFY COLUMN `LastName` VARCHAR(100) NOT NULL, MODIFY COLUMN `CustomerNumber` VARCHAR(20) NOT NULL;",
|
||||
"EnforceCustomerNotNullColumns", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"UPDATE `Vehicles` SET `Make` = 'Unbekannt' WHERE `Make` IS NULL;",
|
||||
"BackfillVehicleMake", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"UPDATE `Vehicles` SET `TireSize` = '' WHERE `TireSize` IS NULL;",
|
||||
"BackfillVehicleTireSize", cancellationToken);
|
||||
await ExecuteSqlSafeAsync(connection,
|
||||
"ALTER TABLE `Vehicles` MODIFY COLUMN `Make` VARCHAR(100) NOT NULL, MODIFY COLUMN `TireSize` VARCHAR(50) NOT NULL DEFAULT '';",
|
||||
"EnforceVehicleNotNullColumns", cancellationToken);
|
||||
|
||||
// Migration: Add 2FA columns to Users table
|
||||
await MigrateAdd2FaColumnsToUsersAsync(connection, cancellationToken);
|
||||
|
||||
@@ -1020,6 +1039,35 @@ public class DatabaseInitializer : IDatabaseInitializer
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
""";
|
||||
|
||||
private const string CreateTireInspectionsTableSql = """
|
||||
CREATE TABLE IF NOT EXISTS `TireInspections` (
|
||||
`Id` CHAR(36) CHARACTER SET ascii NOT NULL,
|
||||
`TireStackId` CHAR(36) CHARACTER SET ascii NOT NULL,
|
||||
`Source` VARCHAR(50) NOT NULL DEFAULT 'Launch TTS01',
|
||||
`RecordSn` VARCHAR(100) NULL,
|
||||
`ReportUrl` VARCHAR(500) NULL,
|
||||
`MeasuredAt` DATETIME(6) NULL,
|
||||
`LicensePlate` VARCHAR(20) NULL,
|
||||
`Mileage` INT NULL,
|
||||
`TreadDepthFL` DECIMAL(5,2) NULL,
|
||||
`TreadDepthFR` DECIMAL(5,2) NULL,
|
||||
`TreadDepthRL` DECIMAL(5,2) NULL,
|
||||
`TreadDepthRR` DECIMAL(5,2) NULL,
|
||||
`RatingFL` INT NOT NULL DEFAULT 0,
|
||||
`RatingFR` INT NOT NULL DEFAULT 0,
|
||||
`RatingRL` INT NOT NULL DEFAULT 0,
|
||||
`RatingRR` INT NOT NULL DEFAULT 0,
|
||||
`Recommendation` VARCHAR(1000) NULL,
|
||||
`RawJson` LONGTEXT NULL,
|
||||
`CreatedAt` DATETIME(6) NOT NULL,
|
||||
`CreatedByUserId` CHAR(36) CHARACTER SET ascii NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
INDEX `IX_TireInspections_TireStackId` (`TireStackId`),
|
||||
INDEX `IX_TireInspections_RecordSn` (`RecordSn`),
|
||||
CONSTRAINT `FK_TireInspections_TireStacks` FOREIGN KEY (`TireStackId`) REFERENCES `TireStacks` (`Id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
""";
|
||||
|
||||
#region Kanban SQL Statements
|
||||
|
||||
private const string CreateKanbanColumnsTableSql = """
|
||||
|
||||
Reference in new issue
Block a user