All Projects → nkonev → r2dbc-migrate

nkonev / r2dbc-migrate

Licence: Apache-2.0 license
R2DBC database migration tool & library

Programming Languages

java
68154 projects - #9 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to r2dbc-migrate

upscheme
Database migrations and schema updates made easy
Stars: ✭ 737 (+787.95%)
Mutual labels:  sql-server, migration, database-migrations, database-management, sqlserver
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+3406.02%)
Mutual labels:  mariadb, database-migrations, database-management, sqlserver
Yuniql
Free and open source schema versioning and database migration made natively with .NET Core.
Stars: ✭ 156 (+87.95%)
Mutual labels:  mariadb, database-migrations, sqlserver
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+21789.16%)
Mutual labels:  sql-server, mariadb, sqlserver
DBTestCompare
Application to compare results of two SQL queries
Stars: ✭ 15 (-81.93%)
Mutual labels:  mariadb, database-migrations, sqlserver
Obevo
Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Stars: ✭ 192 (+131.33%)
Mutual labels:  sql-server, database-migrations, database-management
Evolve
Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
Stars: ✭ 477 (+474.7%)
Mutual labels:  migration, mariadb, sqlserver
migrations
Migrations is a database migration tool that uses go's database/sql from the standard library
Stars: ✭ 17 (-79.52%)
Mutual labels:  sql-server, migration, database-migrations
dbaTDPMon
dbaTDPMon - Troubleshoot Database Performance and Monitoring
Stars: ✭ 20 (-75.9%)
Mutual labels:  sql-server, sqlserver
GraphQL.RepoDB
A set of extensions for working with HotChocolate GraphQL and Database access with micro-orms such as RepoDb (or Dapper). This extension pack provides access to key elements such as Selections/Projections, Sort arguments, & Paging arguments in a significantly simplified facade so this logic can be leveraged in the Serivces/Repositories that enca…
Stars: ✭ 25 (-69.88%)
Mutual labels:  sql-server, sqlserver
sync-client
SyncProxy javascript client with support for all major embedded databases (IndexedDB, SQLite, WebSQL, LokiJS...)
Stars: ✭ 30 (-63.86%)
Mutual labels:  sql-server, sqlserver
datastation
App to easily query, script, and visualize data from every database, file, and API.
Stars: ✭ 2,519 (+2934.94%)
Mutual labels:  sql-server, mariadb
tsql-scripts
Transact-SQL scripts and gists
Stars: ✭ 35 (-57.83%)
Mutual labels:  sql-server, sqlserver
mssql-restapi
A simple REST API for SQL Server, Azure SQL DB and Azure SQL DW using SMO on .NET Core 2.0
Stars: ✭ 33 (-60.24%)
Mutual labels:  sql-server, sqlserver
pypyodbc
pypyodbc is a pure Python cross platform ODBC interface module (pyodbc compatible as of 2017)
Stars: ✭ 39 (-53.01%)
Mutual labels:  sql-server, sqlserver
Gnomock
Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻
Stars: ✭ 398 (+379.52%)
Mutual labels:  sql-server, mariadb
drift-server
Drift server
Stars: ✭ 19 (-77.11%)
Mutual labels:  sql-server, mariadb-server
OrdersManagementSystem
Project demonstrates usage of Prism composition library, Material design library, SQL Server, Entity Framework in WPF application
Stars: ✭ 29 (-65.06%)
Mutual labels:  sql-server, sqlserver
Sqlprovider
A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
Stars: ✭ 423 (+409.64%)
Mutual labels:  sql-server, mariadb
Syncchanges
Synchronize/Replicate database changes using SQL Server Change Tracking
Stars: ✭ 66 (-20.48%)
Mutual labels:  sql-server, sqlserver

R2DBC migration tool

Maven Central Docker Image Version (latest semver) Build Status

Inspired by this announcement. R2DBC page.

Supported databases

  • PostgreSQL
  • Microsoft SQL Server
  • MySQL
  • H2
  • MariaDB

It also supports user-provided dialect. You can pass implementation of SqlQueries interface to the migrate() method. If you use Spring Boot, just define a bean of type SqlQueries. Example SimplePostgresqlDialect.

Features

  • Convention-based file names, for example V3__insert_to_customers__split,nontransactional.sql
  • Pre-migration scripts, for example V0__create_schemas__premigration.sql. Those scripts are invoked every time before entire migration process(e. g. before migration tables created), so you need to make them idempotent. You can use zero or negative version number(s): V-1__create_schemas__nontransactional,premigration.sql
  • It waits until database has been started, then performs test query, and validates its result. This can be useful for the initial data loading into database with docker-compose
  • Supports migrations files larger than -Xmx: file will be split line-by-line (split modifier), then it will be loaded by chunks into the database
  • Supports lock, that make you able to start number of replicas your microservice, without care of migrations collide each other
  • Each migration runs in the separated transaction by default
  • It also supports nontransactional migrations, due to SQL Server 2017 prohibits CREATE DATABASE in the transaction
  • Docker image
  • First-class Spring Boot integration, see example below
  • Also you can use this library without Spring (Boot), see library example below
  • This library tends to be non-invasive, consequently it intentionally doesn't try to parse SQL and make some decisions relying on. So (in theory) you can freely update database and driver's version

All available configuration options are in R2dbcMigrateProperties class. Their descriptions are available in your IDE Ctrl+Space help or in spring-configuration-metadata.json file.

Limitations

  • Currently, this library heavy relies on upsert-like syntax like CREATE TABLE .. ON CONFLICT DO NOTHING. As a result, this library doesn't support run against H2 with MODE=PostgreSQL. Use testcontainers with real PostgreSQL.
  • Only migration forward is supported. No migration back.
  • No checksum validation. So no repeatable migrations.

Download

Docker

docker pull nkonev/r2dbc-migrate:latest

Spring Boot Starter

<dependency>
  <groupId>name.nkonev.r2dbc-migrate</groupId>
  <artifactId>r2dbc-migrate-spring-boot-starter</artifactId>
  <version>VERSION</version>
</dependency>

Only library

<dependency>
    <groupId>name.nkonev.r2dbc-migrate</groupId>
    <artifactId>r2dbc-migrate-core</artifactId>
    <version>VERSION</version>
</dependency>

If you use library, you need also use some implementation of r2dbc-migrate-resource-reader-api, for example:

<dependency>
    <groupId>name.nkonev.r2dbc-migrate</groupId>
    <artifactId>r2dbc-migrate-resource-reader-reflections</artifactId>
    <version>VERSION</version>
</dependency>

See Library example below.

Standalone application

If you want to build your own docker image you will be able to do this

curl -Ss https://repo.maven.apache.org/maven2/name/nkonev/r2dbc-migrate/r2dbc-migrate-standalone/VERSION/r2dbc-migrate-standalone-VERSION.jar > /tmp/migrate.jar

Spring Boot Example

https://github.com/nkonev/r2dbc-migrate-example

Library example

https://github.com/nkonev/r2dbc-migrate-example/tree/library

docker-compose v3 example

version: '3.7'
services:
  migrate:
    image: nkonev/r2dbc-migrate:VERSION
    environment:
      _JAVA_OPTIONS: -Xmx128m
      spring.r2dbc.url: "r2dbc:pool:mssql://mssqlcontainer:1433"
      spring.r2dbc.username: sa
      spring.r2dbc.password: "yourSuperStrong(!)Password"
      r2dbc.migrate.resourcesPath: "file:/migrations/*.sql"
      r2dbc.migrate.validationQuery: "SELECT collation_name as result FROM sys.databases WHERE name = N'master'"
      r2dbc.migrate.validationQueryExpectedResultValue: "Cyrillic_General_CI_AS"
    volumes:
      - ./migrations:/migrations
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].