Skip to content

lamg/migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

NuGet Version NuGet Downloads Tests

Migrate is a tool for performing declarative migrations by finding differences between an expected database schema and the existing one, currently in a SQLite database. It also generates type-safe F# code with CRUD operations for your database schema.

Installation

If you just want to test the tool without installing .Net, then you can use a Docker image:

podman run -it 'mcr.microsoft.com/dotnet/sdk:10.0' bash

Inside the container run:

export PATH="$PATH:/root/.dotnet/tools"

After having .Net in your system you can run

dotnet tool install --global migtool

Quickstart

mkdir test_db
cd test_db
mig init
# generated project files with example definitions
mig status
# output shows migration for existing definitions
mig commit
# generates and executes migration
mig log
# output shows migration metadata and a summary of executed steps
mig codegen
# generates type-safe F# code with CRUD operations

Features

Commands

  • mig init - Initialize a new migration project with example schema files
  • mig status - Generate migration SQL by comparing expected schema with current database
  • mig commit [-m <message>] - Generate and execute migrations step by step
  • mig schema - Show the current database schema
  • mig log [-s <steps-id>] - Show migration history and execution metadata
  • mig codegen [-d <directory>] - Generate type-safe F# code with CRUD operations from SQL schema files
  • mig seed - Execute seed statements (INSERT OR REPLACE) from SQL files

Contributing

How to contribute:

  • Open an issue to discuss the change and approach
  • Add relevant tests
  • Create a pull request mentioning the issue and also including a summary of the problem and approach to solve it
  • Wait for the review

License

Apache 2.0

About

Declarative migrations for SQLite databases

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •