CloudflareD1.NET.Migrations
1.0.1
See the version list below for details.
dotnet add package CloudflareD1.NET.Migrations --version 1.0.1
NuGet\Install-Package CloudflareD1.NET.Migrations -Version 1.0.1
<PackageReference Include="CloudflareD1.NET.Migrations" Version="1.0.1" />
<PackageVersion Include="CloudflareD1.NET.Migrations" Version="1.0.1" />
<PackageReference Include="CloudflareD1.NET.Migrations" />
paket add CloudflareD1.NET.Migrations --version 1.0.1
#r "nuget: CloudflareD1.NET.Migrations, 1.0.1"
#:package CloudflareD1.NET.Migrations@1.0.1
#addin nuget:?package=CloudflareD1.NET.Migrations&version=1.0.1
#tool nuget:?package=CloudflareD1.NET.Migrations&version=1.0.1
CloudflareD1.NET.Migrations
Database migration system for CloudflareD1.NET with fluent API and version tracking.
Features
- ✅ Fluent Migration API: Chain methods to build complex migrations
- ✅ Version Tracking: Automatic history in
__migrationstable - ✅ Up/Down Migrations: Full rollback support
- ✅ Type-Safe Schema Building: Strongly typed column definitions
- ✅ Full DDL Support: CREATE/ALTER/DROP tables, indexes, constraints
- ✅ Programmatic & CLI: Use in code or via CLI tool
- ✅ Well Tested: 29 unit tests + integration tests
Installation
dotnet add package CloudflareD1.NET.Migrations
For CLI tool:
dotnet tool install -g dotnet-d1
Quick Start
Create a Migration
using CloudflareD1.NET.Migrations;
public class CreateUsersTable : Migration
{
public override void Up(MigrationBuilder builder)
{
builder.CreateTable("users", t =>
{
t.Integer("id").PrimaryKey().AutoIncrement();
t.Text("name").NotNull();
t.Text("email").NotNull().Unique();
t.Integer("age");
t.Text("created_at").Default("CURRENT_TIMESTAMP");
});
builder.CreateIndex("users", "idx_users_email", "email");
}
public override void Down(MigrationBuilder builder)
{
builder.DropTable("users");
}
}
Run Migrations Programmatically
using CloudflareD1.NET;
using CloudflareD1.NET.Migrations;
using System.Reflection;
var client = new D1Client(config);
var runner = new MigrationRunner(client, Assembly.GetExecutingAssembly());
// Apply all pending migrations
await runner.MigrateAsync();
// Rollback last migration
await runner.RollbackAsync();
// Get migration history
var history = await runner.GetAppliedMigrationsAsync();
CLI Usage
# Add a new migration
dotnet d1 migrations add CreateUsersTable
# Apply pending migrations
dotnet d1 migrations update
# List migrations
dotnet d1 migrations list
# Rollback last migration
dotnet d1 migrations rollback
Migration API
Table Operations
CreateTable(name, columns)- Create new tableDropTable(name)- Drop existing tableAlterTable(name, columns)- Modify table structure
Column Types
Integer(name)- Integer columnReal(name)- Floating point columnText(name)- Text/string columnBlob(name)- Binary data column
Column Modifiers
.PrimaryKey()- Mark as primary key.AutoIncrement()- Auto-incrementing values.NotNull()- NOT NULL constraint.Unique()- UNIQUE constraint.Default(value)- Default value
Index Operations
CreateIndex(table, name, column)- Create indexCreateUniqueIndex(table, name, column)- Create unique indexDropIndex(table, name)- Drop index
Raw SQL
ExecuteRaw(sql)- Execute custom SQL
Related Packages
- CloudflareD1.NET - Core database client
- CloudflareD1.NET.Linq - LINQ query builder
- dotnet-d1 - CLI tool for migrations
Documentation
Full documentation is available at https://jdtoon.github.io/CloudflareD1.NET/docs/migrations/overview
License
MIT License - see LICENSE for details
| Product | Versions 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. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- CloudflareD1.NET (>= 1.11.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CloudflareD1.NET.Migrations:
| Package | Downloads |
|---|---|
|
CloudflareD1.NET.CodeFirst
Code-First ORM for CloudflareD1.NET. Define your database schema using C# classes and attributes, with automatic migration generation. Includes DbContext pattern, entity relationships, and model-driven development similar to Entity Framework Core but optimized for Cloudflare D1 and SQLite. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.0.1: Documentation improvements and package README. v1.0.0: Initial release with migration support, fluent MigrationBuilder API, history tracking, and rollback capabilities.