migration
This commit is contained in:
parent
4a70abc0f9
commit
89aa2bc37d
6 changed files with 354 additions and 92 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -14,7 +14,7 @@
|
|||
"name": "Yavsc.Org",
|
||||
"type": "dotnet",
|
||||
"request": "launch",
|
||||
"projectPath": "${workspaceFolder}/src/Yavsc.Org/Yavsc.Org.csproj"
|
||||
"projectPath": "${workspaceFolder}/src/Yavsc.Org/Yavsc.Org.csproj",
|
||||
},
|
||||
{
|
||||
"name": "Yavsc.Blogs",
|
||||
|
|
|
|||
|
|
@ -152,6 +152,13 @@ d'abord `appsettings-org.json` du serveur ; sinon, laisse-le en place.
|
|||
(utilisateur, mot de passe, hôte, base). Privilégier
|
||||
`dotnet user-secrets` ou des variables d'environnement `ASPNETCORE_*`
|
||||
plutôt qu'un mot de passe en clair dans le fichier.
|
||||
- Au démarrage, Yavsc.Org applique automatiquement ses migrations EF
|
||||
Core. Sur cette base de code, EF Core 10 peut encore lever un
|
||||
`PendingModelChangesWarning` malgré des migrations et snapshots déjà
|
||||
alignés ; ce faux positif est ignoré sur les contextes PostgreSQL pour
|
||||
éviter un démarrage inutilement en mode dégradé. Si une erreur de
|
||||
migration apparaît encore en production, elle doit être traitée comme
|
||||
une vraie divergence de schéma ou de connexion.
|
||||
- `Smtp.*` — hôte, port, identifiants SMTP pour l'envoi d'e-mails
|
||||
transactionnels.
|
||||
- `Authentication.PayPal.*` et `Authentication.Google.*` — clés d'API
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ using Microsoft.AspNetCore.Localization;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Razor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
|
@ -50,6 +53,30 @@ public static class HostingExtensions
|
|||
{
|
||||
private const string InMemoryProviderName = "InMemory";
|
||||
|
||||
private static void IgnoreKnownFalsePositiveMigrationWarnings(DbContextOptionsBuilder options)
|
||||
{
|
||||
options.ConfigureWarnings(w =>
|
||||
w.Ignore(RelationalEventId.PendingModelChangesWarning));
|
||||
}
|
||||
|
||||
private static async Task ApplyMigrationsAsync<TContext>(IServiceProvider services, ILogger logger)
|
||||
where TContext : DbContext
|
||||
{
|
||||
var contextName = typeof(TContext).Name;
|
||||
var db = services.GetRequiredService<TContext>();
|
||||
|
||||
logger.LogInformation(
|
||||
"Applying database migrations for {DbContext} using provider {Provider}...",
|
||||
contextName,
|
||||
db.Database.ProviderName ?? "(null)");
|
||||
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
logger.LogInformation(
|
||||
"Database migrations applied successfully for {DbContext}.",
|
||||
contextName);
|
||||
}
|
||||
|
||||
public static WebApplication ConfigureWebAppServices(this WebApplicationBuilder builder)
|
||||
{
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
|
@ -155,6 +182,13 @@ public static class HostingExtensions
|
|||
{
|
||||
options.UseNpgsql(connectionString,
|
||||
options => options.MigrationsAssembly(typeof(Program).Assembly));
|
||||
|
||||
// EF Core 10 can raise PendingModelChangesWarning at runtime
|
||||
// even when the snapshot and generated migrations are already
|
||||
// aligned on this codebase. Treat that known false positive as
|
||||
// non-fatal in every environment so production startup matches
|
||||
// the behavior already observed in development.
|
||||
IgnoreKnownFalsePositiveMigrationWarnings(options);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -317,6 +351,7 @@ public static class HostingExtensions
|
|||
{
|
||||
b.UseNpgsql(connectionString,
|
||||
sql => sql.MigrationsAssembly(migrationsAssembly));
|
||||
IgnoreKnownFalsePositiveMigrationWarnings(b);
|
||||
}
|
||||
|
||||
// NOTE: don't b.UseSeeding(...) here — EF Core's UseSeeding
|
||||
|
|
@ -340,6 +375,7 @@ public static class HostingExtensions
|
|||
{
|
||||
b.UseNpgsql(connectionString,
|
||||
sql => sql.MigrationsAssembly(migrationsAssembly));
|
||||
IgnoreKnownFalsePositiveMigrationWarnings(b);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -890,11 +926,13 @@ public static class HostingExtensions
|
|||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
await app.MigrateDatabaseAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
app.MigrateDatabase();
|
||||
logger.LogInformation("Running in production mode. Ensure the database is migrated.");
|
||||
await app.MigrateDatabaseAsync();
|
||||
}
|
||||
|
||||
app.Use(async (context, next) =>
|
||||
|
|
@ -941,26 +979,37 @@ public static class HostingExtensions
|
|||
return app;
|
||||
}
|
||||
|
||||
private static void MigrateDatabase(this IApplicationBuilder app)
|
||||
private static async Task MigrateDatabaseAsync(this IApplicationBuilder app)
|
||||
{
|
||||
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
|
||||
{
|
||||
var logger = serviceScope.ServiceProvider
|
||||
.GetRequiredService<ILoggerFactory>()
|
||||
.CreateLogger("Yavsc.Org.Migrations");
|
||||
|
||||
try
|
||||
{
|
||||
foreach (Type contextType in new Type[]
|
||||
using (var scope = app.ApplicationServices.CreateScope())
|
||||
{
|
||||
typeof(ApplicationDbContext)
|
||||
})
|
||||
{
|
||||
((DbContext)serviceScope.ServiceProvider
|
||||
.GetRequiredService(contextType))
|
||||
.Database.Migrate();
|
||||
await ApplyMigrationsAsync<ApplicationDbContext>(scope.ServiceProvider, logger);
|
||||
}
|
||||
EnsureCriticalSchema(serviceScope.ServiceProvider, logger);
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
app.Properties["DegradedDBContext"] = ex.Message;
|
||||
logger.LogError(
|
||||
ex,
|
||||
"Database migration failed for {DbContext}. App started in degraded mode.",
|
||||
nameof(ApplicationDbContext));
|
||||
|
||||
// EF Core 10 may raise PendingModelChangesWarning as an exception.
|
||||
// Dump a concise model diff to make the mismatch actionable.
|
||||
if (ex is InvalidOperationException ioe
|
||||
&& ioe.Message.Contains("PendingModelChangesWarning", StringComparison.Ordinal))
|
||||
{
|
||||
LogPendingModelChanges(serviceScope.ServiceProvider, logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -973,6 +1022,88 @@ public static class HostingExtensions
|
|||
SeedConfigurationDatabase(app);
|
||||
}
|
||||
|
||||
private static void LogPendingModelChanges(IServiceProvider services, ILogger logger)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var scope = services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
var migrationsAssembly = db.GetService<IMigrationsAssembly>();
|
||||
var snapshotModel = migrationsAssembly.ModelSnapshot?.Model;
|
||||
if (snapshotModel is null)
|
||||
{
|
||||
logger.LogWarning("Pending-model diagnostic: no ModelSnapshot found for ApplicationDbContext.");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.LogWarning(
|
||||
"Pending-model diagnostic: provider={Provider}",
|
||||
db.Database.ProviderName ?? "(null)");
|
||||
|
||||
var runtimeDeclDate = db.Model
|
||||
.FindEntityType("Yavsc.Models.Identity.DeviceDeclaration")?
|
||||
.FindProperty("DeclarationDate")?
|
||||
.GetDefaultValueSql();
|
||||
|
||||
var snapshotDeclDate = snapshotModel
|
||||
.FindEntityType("Yavsc.Models.Identity.DeviceDeclaration")?
|
||||
.FindProperty("DeclarationDate")?
|
||||
.GetDefaultValueSql();
|
||||
|
||||
logger.LogWarning(
|
||||
"Pending-model diagnostic: DeviceDeclaration.DeclarationDate default SQL runtime='{RuntimeDefaultSql}', snapshot='{SnapshotDefaultSql}'.",
|
||||
runtimeDeclDate ?? "(null)",
|
||||
snapshotDeclDate ?? "(null)");
|
||||
|
||||
bool runtimeHasMusicLoverSettings = db.Model.FindEntityType("Yavsc.Models.Musical.Profiles.MusicLoverSettings") is not null;
|
||||
bool snapshotHasMusicLoverSettings = snapshotModel.FindEntityType("Yavsc.Models.Musical.Profiles.MusicLoverSettings") is not null;
|
||||
logger.LogWarning(
|
||||
"Pending-model diagnostic: MusicLoverSettings runtime={RuntimeHas} snapshot={SnapshotHas}.",
|
||||
runtimeHasMusicLoverSettings,
|
||||
snapshotHasMusicLoverSettings);
|
||||
|
||||
bool runtimeHasSignature = db.Model.FindEntityType("Yavsc.Models.Billing.Signature") is not null;
|
||||
bool snapshotHasSignature = snapshotModel.FindEntityType("Yavsc.Models.Billing.Signature") is not null;
|
||||
logger.LogWarning(
|
||||
"Pending-model diagnostic: Signature runtime={RuntimeHas} snapshot={SnapshotHas}.",
|
||||
runtimeHasSignature,
|
||||
snapshotHasSignature);
|
||||
|
||||
bool runtimeHasModerated = db.Model
|
||||
.FindEntityType("Yavsc.Models.Workflow.Activity")?
|
||||
.FindProperty("Moderated") is not null;
|
||||
bool snapshotHasModerated = snapshotModel
|
||||
.FindEntityType("Yavsc.Models.Workflow.Activity")?
|
||||
.FindProperty("Moderated") is not null;
|
||||
logger.LogWarning(
|
||||
"Pending-model diagnostic: Activity.Moderated runtime={RuntimeHas} snapshot={SnapshotHas}.",
|
||||
runtimeHasModerated,
|
||||
snapshotHasModerated);
|
||||
}
|
||||
catch (Exception diagEx)
|
||||
{
|
||||
logger.LogError(diagEx, "Pending-model diagnostic failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureCriticalSchema(IServiceProvider services, ILogger logger)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = services.GetRequiredService<ApplicationDbContext>();
|
||||
|
||||
// Hotfix guard: keep startup resilient if a migration was skipped,
|
||||
// while still allowing EF migrations to be the source of truth.
|
||||
db.Database.ExecuteSqlRaw(@"
|
||||
ALTER TABLE ""Activities""
|
||||
ADD COLUMN IF NOT EXISTS ""Moderated"" boolean NOT NULL DEFAULT FALSE;");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Critical schema check failed for Activities.Moderated.");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SeedConfigurationDatabase(IApplicationBuilder app)
|
||||
{
|
||||
try
|
||||
|
|
@ -981,13 +1112,26 @@ public static class HostingExtensions
|
|||
.GetRequiredService<IServiceScopeFactory>()
|
||||
.CreateScope();
|
||||
|
||||
var logger = app.ApplicationServices
|
||||
.GetRequiredService<ILoggerFactory>()
|
||||
.CreateLogger("Yavsc.Org.Seeding");
|
||||
|
||||
var configurationDb = scope.ServiceProvider
|
||||
.GetRequiredService<IdentityServer8.EntityFramework.DbContexts.ConfigurationDbContext>();
|
||||
|
||||
var configuration = scope.ServiceProvider
|
||||
.GetRequiredService<IConfiguration>();
|
||||
|
||||
logger.LogInformation(
|
||||
"Running seed for {DbContext} using provider {Provider}...",
|
||||
nameof(IdentityServer8.EntityFramework.DbContexts.ConfigurationDbContext),
|
||||
configurationDb.Database.ProviderName ?? "(null)");
|
||||
|
||||
EnsureDefaultConfiguration(configuration)(configurationDb, true);
|
||||
|
||||
logger.LogInformation(
|
||||
"Seed completed for {DbContext}.",
|
||||
nameof(IdentityServer8.EntityFramework.DbContexts.ConfigurationDbContext));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -997,7 +1141,10 @@ public static class HostingExtensions
|
|||
var logger = app.ApplicationServices
|
||||
.GetRequiredService<ILoggerFactory>()
|
||||
.CreateLogger("Yavsc.Org.Seeding");
|
||||
logger.LogError(ex, "ConfigurationDb seeding failed.");
|
||||
logger.LogError(
|
||||
ex,
|
||||
"Seed failed for {DbContext}.",
|
||||
nameof(IdentityServer8.EntityFramework.DbContexts.ConfigurationDbContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ using Yavsc.Models;
|
|||
namespace Yavsc.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20260704154837_moderatedActivities")]
|
||||
partial class moderatedActivities
|
||||
[Migration("20260706013420_activityModerated")]
|
||||
partial class activityModerated
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
|
|
@ -1921,9 +1921,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -1944,9 +1941,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -1966,7 +1960,7 @@ namespace Yavsc.Migrations
|
|||
b.Property<long>("PrestationId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("SelectedProfileUserId")
|
||||
|
|
@ -2011,9 +2005,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -2031,9 +2022,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -2050,7 +2038,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
|
@ -2655,7 +2643,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("GeneralSettings");
|
||||
b.ToTable("MusicLoverSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b =>
|
||||
|
|
@ -3094,9 +3082,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -3114,9 +3099,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -3136,7 +3118,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
|
|
@ -3243,9 +3225,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -3263,9 +3242,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -3286,7 +3262,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
|
@ -3988,7 +3964,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4018,7 +3994,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("Prestation");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
|
||||
b.Navigation("SelectedProfile");
|
||||
});
|
||||
|
|
@ -4041,7 +4017,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4059,7 +4035,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b =>
|
||||
|
|
@ -4414,7 +4390,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4432,7 +4408,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b =>
|
||||
|
|
@ -4474,7 +4450,7 @@ namespace Yavsc.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4490,7 +4466,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
|
||||
b.Navigation("Repository");
|
||||
});
|
||||
|
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
namespace Yavsc.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class moderatedActivities : Migration
|
||||
public partial class activityModerated : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
|
|
@ -16,6 +16,51 @@ namespace Yavsc.Migrations
|
|||
name: "FK_MusicalPreference_GeneralSettings_GeneralSettingsUserId",
|
||||
table: "MusicalPreference");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GeneralSettings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Accepted",
|
||||
table: "RdvQueries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Decided",
|
||||
table: "RdvQueries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Accepted",
|
||||
table: "Project");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Decided",
|
||||
table: "Project");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Accepted",
|
||||
table: "HairMultiCutQueries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Decided",
|
||||
table: "HairMultiCutQueries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Accepted",
|
||||
table: "HairCutQueries");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Decided",
|
||||
table: "HairCutQueries");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Previsional",
|
||||
table: "RdvQueries",
|
||||
newName: "Provisional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Previsional",
|
||||
table: "Project",
|
||||
newName: "Provisional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "GeneralSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
|
|
@ -26,6 +71,16 @@ namespace Yavsc.Migrations
|
|||
table: "MusicalPreference",
|
||||
newName: "IX_MusicalPreference_MusicLoverSettingsUserId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Previsional",
|
||||
table: "HairMultiCutQueries",
|
||||
newName: "Provisional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Previsional",
|
||||
table: "HairCutQueries",
|
||||
newName: "Provisional");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Bug",
|
||||
|
|
@ -43,6 +98,17 @@ namespace Yavsc.Migrations
|
|||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MusicLoverSettings",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MusicLoverSettings", x => x.UserId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Signatures",
|
||||
columns: table => new
|
||||
|
|
@ -86,10 +152,10 @@ namespace Yavsc.Migrations
|
|||
column: "SignerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_MusicLoverSettingsUserId",
|
||||
name: "FK_MusicalPreference_MusicLoverSettings_MusicLoverSettingsUser~",
|
||||
table: "MusicalPreference",
|
||||
column: "MusicLoverSettingsUserId",
|
||||
principalTable: "GeneralSettings",
|
||||
principalTable: "MusicLoverSettings",
|
||||
principalColumn: "UserId");
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +163,12 @@ namespace Yavsc.Migrations
|
|||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_MusicLoverSettingsUserId",
|
||||
name: "FK_MusicalPreference_MusicLoverSettings_MusicLoverSettingsUser~",
|
||||
table: "MusicalPreference");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MusicLoverSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Signatures");
|
||||
|
||||
|
|
@ -107,6 +176,16 @@ namespace Yavsc.Migrations
|
|||
name: "Moderated",
|
||||
table: "Activities");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Provisional",
|
||||
table: "RdvQueries",
|
||||
newName: "Previsional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Provisional",
|
||||
table: "Project",
|
||||
newName: "Previsional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "MusicLoverSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
|
|
@ -117,6 +196,72 @@ namespace Yavsc.Migrations
|
|||
table: "MusicalPreference",
|
||||
newName: "IX_MusicalPreference_GeneralSettingsUserId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Provisional",
|
||||
table: "HairMultiCutQueries",
|
||||
newName: "Previsional");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Provisional",
|
||||
table: "HairCutQueries",
|
||||
newName: "Previsional");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Accepted",
|
||||
table: "RdvQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Decided",
|
||||
table: "RdvQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Accepted",
|
||||
table: "Project",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Decided",
|
||||
table: "Project",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Accepted",
|
||||
table: "HairMultiCutQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Decided",
|
||||
table: "HairMultiCutQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Accepted",
|
||||
table: "HairCutQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Decided",
|
||||
table: "HairCutQueries",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Description",
|
||||
table: "Bug",
|
||||
|
|
@ -127,6 +272,17 @@ namespace Yavsc.Migrations
|
|||
oldMaxLength: 10240,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GeneralSettings",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GeneralSettings", x => x.UserId);
|
||||
});
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MusicalPreference_GeneralSettings_GeneralSettingsUserId",
|
||||
table: "MusicalPreference",
|
||||
|
|
@ -1918,9 +1918,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -1941,9 +1938,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -1963,7 +1957,7 @@ namespace Yavsc.Migrations
|
|||
b.Property<long>("PrestationId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("SelectedProfileUserId")
|
||||
|
|
@ -2008,9 +2002,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -2028,9 +2019,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -2047,7 +2035,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
|
@ -2652,7 +2640,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("GeneralSettings");
|
||||
b.ToTable("MusicLoverSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Payment.PayPalPayment", b =>
|
||||
|
|
@ -3091,9 +3079,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -3111,9 +3096,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -3133,7 +3115,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
|
|
@ -3240,9 +3222,6 @@ namespace Yavsc.Migrations
|
|||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<bool>("Accepted")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ActivityCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
|
@ -3260,9 +3239,6 @@ namespace Yavsc.Migrations
|
|||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("Decided")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
|
|
@ -3283,7 +3259,7 @@ namespace Yavsc.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal?>("Previsional")
|
||||
b.Property<decimal?>("Provisional")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
|
@ -3985,7 +3961,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4015,7 +3991,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("Prestation");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
|
||||
b.Navigation("SelectedProfile");
|
||||
});
|
||||
|
|
@ -4038,7 +4014,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4056,7 +4032,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Haircut.HairPrestationCollectionItem", b =>
|
||||
|
|
@ -4411,7 +4387,7 @@ namespace Yavsc.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("LocationId");
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4429,7 +4405,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yavsc.Models.Workflow.UserActivity", b =>
|
||||
|
|
@ -4471,7 +4447,7 @@ namespace Yavsc.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularisation")
|
||||
b.HasOne("Yavsc.Models.Payment.PayPalPayment", "Regularization")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId");
|
||||
|
||||
|
|
@ -4487,7 +4463,7 @@ namespace Yavsc.Migrations
|
|||
|
||||
b.Navigation("PerformerProfile");
|
||||
|
||||
b.Navigation("Regularisation");
|
||||
b.Navigation("Regularization");
|
||||
|
||||
b.Navigation("Repository");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue