Chd.Library.Migrations 8.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package Chd.Library.Migrations --version 8.0.9                
NuGet\Install-Package Chd.Library.Migrations -Version 8.0.9                
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="Chd.Library.Migrations" Version="8.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chd.Library.Migrations --version 8.0.9                
#r "nuget: Chd.Library.Migrations, 8.0.9"                
#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 Chd.Library.Migrations as a Cake Addin
#addin nuget:?package=Chd.Library.Migrations&version=8.0.9

// Install Chd.Library.Migrations as a Cake Tool
#tool nuget:?package=Chd.Library.Migrations&version=8.0.9                

Migration library for .Net Core

Chd (cleverly handle difficulty) library helps you cleverly handle difficulty, writing code fastly and do your application stable.

📝 Table of Contents

🧐 About

Migrations are a structured way to alter your database schema and are an alternative to creating lots of sql scripts that have to be run manually by every developer involved.

🏁 Getting Started

This migrations using a table called VersionInfo. Each record in this table contains a unique VersionId.

Prerequisites

You must use .net core 8.0 or higher

🔧 Running the tests for PostgreSQL datatabase

    [TestClass]
    public  class MigrationTestForPostgreSQL
    {
        [Logged]
        [TestMethod]
        public void Test()
        {
            // ==> builder.Services.UseMigration<Program>(Library.Migrations.Enums.DatabaseType.PostgreSQL,"PostgreSQLTest"); //In project usings
            MigrationDependencyInjectionExtensions.AddMigration<MigrationForPostgreSQL>(null, Library.Migrations.Enums.DatabaseType.PostgreSQL, "PostgreSQLTest");
            Thread.Sleep(30000);
        }
    }

    [Migration(12,"mehmet")]
    public class MigrationForPostgreSQL : Migration
    {
        public override void Down()
        {
        }
        public override void Up()
        {
            Create.Table("deneme").WithIdColumn().WithColumn("name").AsString();
        }
    }

🔧 Running the tests for Oracle datatabase

   [TestClass]
    public  class MigrationTestForOracle
    {
        [Logged]
        [TestMethod]
        public void Test()
        {
            //==> builder.Services.UseMigration<Program>(Library.Migrations.Enums.DatabaseType.SQLite,"OracleTest"); //In project usings
            MigrationDependencyInjectionExtensions.AddMigration<MigrationForOracle>(null, Library.Migrations.Enums.DatabaseType.SQLite, "OracleTest");
            Thread.Sleep(30000);
        }
    }

    [Migration(12,"mehmet")]
    public class MigrationForOracle : Migration
    {
        public override void Down()
        {
        }
        public override void Up()
        {
            Create.Table("deneme").WithIdColumn().WithColumn("name").AsString();
        }
    }

🔧 Running the tests for MsSQL datatabase

    [TestClass]
    public  class MigrationTestForMsSQL
    {
        [Logged]
        [TestMethod]
        public void Test()
        {
            // ==> builder.Services.UseMigration<Program>(Library.Migrations.Enums.DatabaseType.MsSQL,"MsSQLTest"); //In project usings
            MigrationDependencyInjectionExtensions.AddMigration<MigrationForMsSQL>(null, Library.Migrations.Enums.DatabaseType.MsSQL, "MsSQLTest");
            Thread.Sleep(30000);
        }
    }

    [Migration(12,"mehmet")]
    public class MigrationForMsSQL : Migration
    {
        public override void Down()
        {
        }
        public override void Up()
        {
            Create.Table("deneme").WithIdColumn().WithColumn("name").AsString();
        }
    }

🔧 Running the tests for SQLite datatabase

    [TestClass]
    public  class MigrationTestForSQLite
    {
        [Logged]
        [TestMethod]
        public void Test()
        {
            // ==> builder.Services.UseMigration<Program>(Library.Migrations.Enums.DatabaseType.SQLite,"SQLiteTest"); //In project usings
            MigrationDependencyInjectionExtensions.AddMigration<MigrationForSQLite>(null, Library.Migrations.Enums.DatabaseType.SQLite, "SQLiteTest");
            Thread.Sleep(30000);
        }
    }

    [Migration(12,"mehmet")]
    public class MigrationForSQLite : Migration
    {
        public override void Down()
        {
        }
        public override void Up()
        {
            Create.Table("deneme").WithIdColumn().WithColumn("name").AsString();
        }
    }

Apsettings Configurations

You must add code below in appsettings.json

  "ConnectionStrings": {
    "SQLiteTest": "Data Source=mydb.db;",
    "OracleTest":"Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;",
    "MsSQLTest": "Data Source=mydb.db;",
    "PostgreSQLTest": "IncludeErrorDetails = true;User ID=postgres;Password=library_postgres_admin;Server=localhost;Port=5432;Database=KUSYS_db;Integrated Security=true;Pooling=true;",
  }

Test Result

After running test, you can see sample table on database.

🎈 Usage

Just run the application to get the migrations work done.

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

Thank you for using my library.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
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
9.0.7 42 1/30/2025
9.0.6 113 1/1/2025
9.0.5 82 12/30/2024
9.0.4 83 12/29/2024
8.0.9 86 12/23/2024
8.0.8 82 12/23/2024
7.4.5 538 9/4/2023
7.4.4 505 9/4/2023