Reference

SkipMigrations

Package Trax.Effect.Data.PostgresNamespace Trax.Effect.Data.Postgres.ExtensionsSource ServiceExtensions.cs

Turns off the schema migration that UsePostgres and UseSqlite run when they are called.

Signature

public static TraxEffectBuilder SkipMigrations(
    this TraxEffectBuilder builder
)

Returns

TraxEffectBuilder, the same builder, for chaining the data provider after it.

Behavior

Sets TraxEffectBuilder.MigrationsDisabled. UsePostgres and UseSqlite read the flag when they are called, so SkipMigrations comes before them in the chain; called after, it has no effect on that provider. Everything else the provider registers is unchanged. The flag is carried over when the builder becomes TraxEffectBuilderWithData.

With migrations skipped, the schema must already be current before the host serves work: DatabaseMigrator.Migrate(connectionString) applies it from anywhere. See DatabaseMigrator.

Example

services.AddTrax(trax => trax
    .AddEffects(effects => effects
        .SkipMigrations()
        .UsePostgres(connectionString)
    )
    .AddMediator(typeof(IShipOrderTrain).Assembly)
);

See also