(`-').-> <-.(`-') _ _ (`-')
( OO)_ __( OO) (_) \-.(OO ) .->
(_)--\_) '-'. ,--. ,-(`-') _.' \ ,--.' ,-.
/ _ / | .' / | ( OO) (_...--'' (`-')'.' /
\_..`--. | /) | | ) | |_.' | (OO \ /
.-._) \ | . ' (| |_/ | .___.' | / /)
\ / | |\ \ | |'-> | | `-/ /`
`-----' `--' '--' `--' `--' `--'
Skipy is a tool to handle database updates on a project.
You can build or use the provider adapted to your project and use the Skipy cli to update your database.
status
: display the list of the updates with their status. ex: ./skipy status
or skipy.exe status
update <ID>
: update the database by selecting an update. ex: ./skipy update
or skipy.exe update
update -Id <ID>
: update the database to the specified update. ex: ./skipy update -Id 20210827163757
or skipy.exe update -Id 20210827163757
update -Name <Name>
: update the database to the specified update. ex: ./skipy update -Name MyUpdateName
or skipy.exe update -Name MyUpdateName
- Create a new application console project
- Include the
Skipy
nuget and theSkipy.Core
nuget - Add a new module class which implements the
IModule
interface or use directly theModule<MyUpdateProvider>
class (the class MyUpdateProvider must implement the interfaceIUpdateProvider
) - In the
Main
method of your application, add the following lines to call the Skipy console :
public class Program
{
static void Main(string[] args)
{
// Create a new console
var console = new SkipyConsole();
// Add the module
console.AddProvider<Module<MyUpdateProvider>>();
// Start the console
console.Start(args);
}
}
Create a new project and add two classes :
-
a class which implements the
IUpdateProvider
to handle the database updates -
a class which implements the
IModule
interface to declare a new module in the console.
Example (with the Entity Framework provider available in the Skipy.EntityFramework.Provider
nuget) :
public class MyModule : Module<EntityFrameworkProvider<MyDbContext>>
{
public override void ConfigureServices(IServiceCollection serviceCollection, IConfiguration configuration)
{
base.ConfigureServices(serviceCollection, configuration);
// Database connection
serviceCollection.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
// Update provider
serviceCollection.AddScoped<IUpdateProvider, EntityFrameworkProvider<MyDbContext>>();
}
}