- Backend : projets, solution, namespaces et références TrajetKmTracker.Api/.Tests -> SchotzIadKmTracker.Api/.Tests (dossiers, .csproj, .sln, .http, namespaces C#). GUID UserSecretsId préservé. - Specs : dossier .kiro/specs/trajet-km-tracker -> schotziad-km-tracker et mise à jour des références internes (chemins, tags de propriétés). - Frontend : projet Angular trajet-km-tracker -> schotziad-km-tracker (package.json, angular.json, chemin dist, Dockerfile), titre applicatif 'SchotzIAD KM Tracker'. - Docker et scripts (backend/Dockerfile, frontend/Dockerfile, run-dev.sh) mis à jour. - Suppression du fichier résiduel package.json.bak. Backend (solution) et frontend (build production) compilent sans erreur.
242 lines
11 KiB
C#
242 lines
11 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SchotzIadKmTracker.Api.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AdresseCache",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Adresse = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
|
Latitude = table.Column<double>(type: "REAL", nullable: false),
|
|
Longitude = table.Column<double>(type: "REAL", nullable: false),
|
|
GeometrieJson = table.Column<string>(type: "TEXT", nullable: true),
|
|
DerniereUtilisation = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AdresseCache", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AdressesNommees",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Denomination = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
DenominationNormalisee = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
|
Adresse = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
|
Latitude = table.Column<double>(type: "REAL", nullable: true),
|
|
Longitude = table.Column<double>(type: "REAL", nullable: true),
|
|
GeocodageReussi = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AdressesNommees", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Profil",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Nom = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
|
Prenom = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
|
Matricule = table.Column<string>(type: "TEXT", maxLength: 8, nullable: true),
|
|
AdresseDomicile = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
|
DomicileLatitude = table.Column<double>(type: "REAL", nullable: true),
|
|
DomicileLongitude = table.Column<double>(type: "REAL", nullable: true),
|
|
DomicileGeocode = table.Column<bool>(type: "INTEGER", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Profil", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "TranchesBareme",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Annee = table.Column<int>(type: "INTEGER", nullable: false),
|
|
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
|
KmMin = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
KmMax = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Coefficient = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Base = table.Column<decimal>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_TranchesBareme", x => x.Id);
|
|
table.CheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Vehicules",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Plaque = table.Column<string>(type: "TEXT", maxLength: 15, nullable: false),
|
|
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
|
DateEffet = table.Column<DateOnly>(type: "TEXT", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Vehicules", x => x.Id);
|
|
table.CheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "MontantsRegles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Annee = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Mois = table.Column<int>(type: "INTEGER", nullable: false),
|
|
VehiculeId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
Montant = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_MontantsRegles", x => x.Id);
|
|
table.CheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
|
table.CheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
|
table.ForeignKey(
|
|
name: "FK_MontantsRegles_Vehicules_VehiculeId",
|
|
column: x => x.VehiculeId,
|
|
principalTable: "Vehicules",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Trajets",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
.Annotation("Sqlite:Autoincrement", true),
|
|
Date = table.Column<DateOnly>(type: "TEXT", nullable: false),
|
|
AdresseDepart = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
|
AdresseArrivee = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
|
Distance = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
Commentaire = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
|
|
Position = table.Column<decimal>(type: "TEXT", nullable: false),
|
|
VehiculeId = table.Column<int>(type: "INTEGER", nullable: false),
|
|
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Trajets", x => x.Id);
|
|
table.CheckConstraint("CK_Trajets_Distance", "\"Distance\" > 0");
|
|
table.CheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
|
table.ForeignKey(
|
|
name: "FK_Trajets_Vehicules_VehiculeId",
|
|
column: x => x.VehiculeId,
|
|
principalTable: "Vehicules",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AdresseCache_Adresse",
|
|
table: "AdresseCache",
|
|
column: "Adresse",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UX_AdresseNommee_Denomination",
|
|
table: "AdressesNommees",
|
|
column: "DenominationNormalisee",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MontantsRegles_VehiculeId",
|
|
table: "MontantsRegles",
|
|
column: "VehiculeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UX_MontantsRegles_Periode_Vehicule",
|
|
table: "MontantsRegles",
|
|
columns: new[] { "Annee", "Mois", "VehiculeId" },
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UX_Profil_Singleton",
|
|
table: "Profil",
|
|
column: "Id",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Trajets_Date",
|
|
table: "Trajets",
|
|
column: "Date");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Trajets_Date_Position",
|
|
table: "Trajets",
|
|
columns: new[] { "Date", "Position" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Trajets_Vehicule",
|
|
table: "Trajets",
|
|
column: "VehiculeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_TranchesBareme_Annee_PF",
|
|
table: "TranchesBareme",
|
|
columns: new[] { "Annee", "PuissanceFiscale" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Vehicules_DateEffet",
|
|
table: "Vehicules",
|
|
column: "DateEffet");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AdresseCache");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AdressesNommees");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "MontantsRegles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Profil");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Trajets");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "TranchesBareme");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Vehicules");
|
|
}
|
|
}
|
|
}
|