Cassandra.Fluent.Migrator 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Cassandra.Fluent.Migrator --version 1.0.0
NuGet\Install-Package Cassandra.Fluent.Migrator -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cassandra.Fluent.Migrator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Cassandra.Fluent.Migrator --version 1.0.0
#r "nuget: Cassandra.Fluent.Migrator, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Cassandra.Fluent.Migrator as a Cake Addin
#addin nuget:?package=Cassandra.Fluent.Migrator&version=1.0.0

// Install Cassandra.Fluent.Migrator as a Cake Tool
#tool nuget:?package=Cassandra.Fluent.Migrator&version=1.0.0

Cassandra Fluent Migrator

Cassandra Fluent library

Cassandra Fluent Migrator is a library that offers a set of fluent code and extensions to facilitate the creation and management of the migrations using code instead of CQL commands.

Stack

Installation

PM> Install-Package Cassandra.Fluent.Migrator

Future Improvements

  • Add support for more complex types.
  • Add support for the Materialized views.
  • Convert the library to DotNet Standard.

Documentations

Basic Usage

  • Migration class

In your project create a migration class that implements the IMigrator Interface as follow:

public class InitialMigration: IMigrator
{
    private readonly ICassandraFluentMigrator cfm;
    private readonly ILogger<InitialMigration> logger;

    public InitialMigration(ILogger<InitialMigration> logger, ICassandraFluentMigrator cfm)
    {
        this.cfm = cfm;
        this.logger = logger;
    }

    public string Name => this.GetType().Name;
    public Version Version => new Version(1, 0, 0);
    public string Description => "First migration to initialize the Schema";

    public async Task ApplyMigrationAsync()
    {
        this.logger.LogDebug($"Creating the Address User-Defined type...");
        await this.cfm.CreateUserDefinedTypeAsync<Address>();

        // Should not be here in real-world application.
        // Used only for example purposes.
        this.cfm
            .GetCassandraSession()
                .UserDefinedTypes.Define(
                UdtMap.For<Address>()
                    .Map(a => a.Number, "Number".ToLower())
                    .Map(a => a.Street, "Street".ToLower())
                    .Map(a => a.City, "City".ToLower())
                    .Map(a => a.Contry, "Contry".ToLower())
                    .Map(a => a.Province, "Province".ToLower())
                    .Map(a => a.PostalCode, "PostalCode".ToLower()));

        this.logger.LogDebug($"Creating the User table...");
        await this.cfm.GetTable<Users>().CreateIfNotExistsAsync();
    }
}
  • Startup class
public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers();

    // Custom method that you can create to initialize the Cassandra {ISession}.
    services.AddCassandraSession(this.Configuration);

    // Register the migrations
    services.AddTransient<IMigrator, InitialMigration>();

    // Required by the library to register the needed classes.
    services.AddCassandraFluentMigratorServices();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...

    // Start the migration process.
    app.UseCassandraMigration();

    ...
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 256 11/2/2023
1.0.3 1,438 3/7/2022
1.0.2 2,924 12/21/2020
1.0.1 531 8/26/2020
1.0.0 573 6/7/2020

v1.0.0