Chd.Library.Migrations
8.0.8
See the version list below for details.
dotnet add package Chd.Library.Migrations --version 8.0.8
NuGet\Install-Package Chd.Library.Migrations -Version 8.0.8
<PackageReference Include="Chd.Library.Migrations" Version="8.0.8" />
paket add Chd.Library.Migrations --version 8.0.8
#r "nuget: Chd.Library.Migrations, 8.0.8"
// Install Chd.Library.Migrations as a Cake Addin #addin nuget:?package=Chd.Library.Migrations&version=8.0.8 // Install Chd.Library.Migrations as a Cake Tool #tool nuget:?package=Chd.Library.Migrations&version=8.0.8
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
- Getting Started
- Running the tests for PostgreSQL datatabase
- Running the tests for Mssql datatabase
- Running the tests for SqlLite datatabase
- Usage
- Authors
- Acknowledgments
🧐 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 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;",
"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
- Mehmet Yoldaş - Linkedin
See also the list of contributors who participated in this project.
🎉 Acknowledgements
Thank you for using my library.
Product | Versions 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. |
-
net8.0
- Chd.Library.Core (>= 8.0.1)
- FluentMigrator.Runner (>= 3.3.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Data.Sqlite (>= 8.0.1)
- Microsoft.EntityFrameworkCore.Design (>= 8.0.1)
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.1)
- Microsoft.EntityFrameworkCore.Sqlite.Core (>= 8.0.1)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.