![]() |
VOOZH | about |
dotnet add package Sable --version 0.0.2
NuGet\Install-Package Sable -Version 0.0.2
<PackageReference Include="Sable" Version="0.0.2" />
<PackageVersion Include="Sable" Version="0.0.2" />Directory.Packages.props
<PackageReference Include="Sable" />Project file
paket add Sable --version 0.0.2
#r "nuget: Sable, 0.0.2"
#:package Sable@0.0.2
#addin nuget:?package=Sable&version=0.0.2Install as a Cake Addin
#tool nuget:?package=Sable&version=0.0.2Install as a Cake Tool
<p align="center"> <a href="https://bloomberg.github.io/sable/" target="_blank" rel="noopener noreferrer"> <img width="180" src="./_docs/public/logo.svg" alt="Sable logo"> </a> </p>
Database Migration Management Tool for Marten
Sable (Martes zibellina) is a species of marten.
Before starting, ensure the following prerequisites are met:
dotnet tool install -g Sable.Cli
See .NET tools to learn more about how .NET tools work.
This guide assumes you have experience with configuring Marten together with its command line tooling support in .NET projects. If that is not the case, please take a look at the following guides before proceeding:
Now we're going to integrate Sable into a new project.
dotnet new webapi
dotnet add package Sable
Now for the fun part. Replace whatever overload of AddMarten you're using with AddMartenWithSableSupport. That's all it takes to complete the integration.
At this point, you should have a configuration that looks something like this:
using Marten;
using Oakton;
using Sable.Extensions;
using Sable.Samples.Core;
using Weasel.Core;
var builder = WebApplication.CreateBuilder(args);
builder.Host.ApplyOaktonExtensions();
builder.Services.AddMartenWithSableSupport(_ =>
{
var options = new StoreOptions();
options.Connection(builder.Configuration["Databases:Books:BasicTier"]);
options.DatabaseSchemaName = "books";
options.AutoCreateSchemaObjects = AutoCreate.None;
options.Schema.For<Book>()
.Index(x => x.Contents);
return options;
});
var app = builder.Build();
app.MapGet("/", () => "💪🏾");
return await app.RunOaktonCommands(args);
Okay. Now that your project is properly configured, what's next? In your project directory, run the following command:
sable init --database <database-name> --schema <schema-name>
The default values for the database and schema names are Marten and public, respectively.
Marten is the name associated with the database for the default configuration. This is important, especially when multiple databases are used in the same project.
Running the command above should also have created some migration files in the ./sable/<database-name>/migrations directory.
Now, to update the database, follow either one of the following stategies:
sable migrations script --database <database-name>
Running the command above should have created a migration script in the ./sable/<database-name>/scripts directory.
You can now take that script and apply it manually to your database.
OR
sable database update <connection-string> --database <database-name>
Running the command above should have applied the pending migrations to your database.
Okay. Everything is good so far, but you just added a new index to a document and want to update the database. What do you do? That's pretty simple. Just add a new migration:
sable migrations add AddIndexOnName --database <database-name>
Running the command above should have created a new migration file in the ./sable/<database-name>/migrations directory.
To apply that migration, just follow one of the database update strategies outlined above one more time.
To learn more, check out the documentation.
We ❤️ contributions.
Have you had a good experience with this project? Why not share some love and contribute code, or just let us know about any issues you had with it?
We welcome issue reports ; be sure to choose the proper issue template for your issue, so that we can be sure you're providing the necessary information.
Before sending a , please make sure you read our Contribution Guidelines.
Please read the file.
This project has adopted a Code of Conduct. If you have any concerns about the Code, or behavior which you have experienced in the project, please contact us at opensource@bloomberg.net.
If you believe you have identified a security vulnerability in this project, you may submit a private vulnerability disclosure.
Please do NOT open an issue in the GitHub repository, as we'd prefer to keep vulnerability reports private until we've had an opportunity to review and address them.
If you have any questions or concerns, please send an email to the Bloomberg OSPO at opensource@bloomberg.net.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Sable:
| Package | Downloads |
|---|---|
|
Sable.Samples.Core
Package Description |
This package is not used by any popular GitHub repositories.