Skip to content

LiteMigrator sample .NET MAUI for migrating up your SQLite database with scripts. Never let your system get out of sync

License

Notifications You must be signed in to change notification settings

SuessLabs/LiteMigrator.Sample

Repository files navigation

SQLite Lite Migrator .NET Sample Project

LiteMigrator is a tiny cross-platform SQLite migration framework for .NET cross-platform applications using (.NET Standard). This library was built for use with .NET MAUI 🐒, Avalonia, and Uno projects. So it needs to be quick, simple, and reliable when managing databases.

LiteMigrator takes a "migrate-up" approach. In most app deployments, we usually move forward and rarely downgrade (consider app stores). This helps keep the library small and nimble. Previously known as, SQLiteMigrator.

LiteMigrator Docs

Breaking Change from 0.6.x to now:

Namespace changed from Xeno.LiteMigrator to LiteMigrator

Brought to you with nerd-love by Suess Labs, sponsored by Xeno Innovations.

Saving files

Check out the .NET MAUI article on file system helpers for where you can store your files.

Platforms Supported

Platform Status
Windows Yes
Linux Yes
Android Yes
iOS Yes

Contribute today and get your platform supported 👍

How to use it

Get LiteMigrator on NuGet today!

Getting Started

Detailed instructions can be found on the Using LiteMigrator wiki page.

  1. Add LiteMigrator project to your solution
  2. Create a folder in your solution to hold the scripts
  3. Add SQL files as Embedded Resources
    • You must use the naming convention, "YYYYMMDDhhmm-FileName.sql"
  4. Wire-up the controller

Use Case 1

  var scriptNamespace = "MyProject.Namespace.Scripts";

  using (var migrator = new LiteMigration(
    "c:\\path\\to\\sqlite.db3",
    scriptNamespace,
    Assembly.GetExecutingAssembly()))
  {
    bool isSuccessful = await migrator.MigrateUpAsync();
  }

Use Case 2 - Class Constructor

public async Task InstallMigrationsAsync()
{
  // Your EXE/DLL with the scripts
  var dbPath = @"C:\TEMP\MyDatabase.db3";
  var migsNamespace = "MyProjNamespace.Scripts";
  var resourceAssm = Assembly.GetExecutingAssembly();

  var liteMig = new LiteMigration(dbPath, migsNamespace, resourceAssm);
  bool = success = await liteMig.MigrateUpAsync();

  // Required after v0.6
  liteMig.Dispose();
}

How to Contribute

Give it a test drive and support making LiteMigrator better :)

  1. Fork on GitHub
  2. Create a branch
  3. Code (and add tests)
  4. Create a Pull Request (PR) on GitHub
    1. Target the develop branch and we'll get it merged up to master
    2. Target the master branch for hotfixes
  5. Get the PR merged
  6. Welcome to our contributors' list!

This project could use your assistance to crush any limitations.

Please visit the Known Limitations wiki page

About

LiteMigrator sample .NET MAUI for migrating up your SQLite database with scripts. Never let your system get out of sync

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages