Git Product home page Git Product logo

liquibase-mongodb's Introduction

Liquibase MongoDB Extension

Build Status

Table of contents

  1. Introduction
  2. Release Notes
  3. Implemented Changes
  4. Connection String Formats
  5. Getting Started
  6. Running tests
  7. Integration
  8. Contributing
  9. License

Introduction

This is a Liquibase extension for MongoDB support.

It resulted as an alternative to existing MongoDB evolution tools.
Majority of them are basically wrappers over db.eval shell method that is deprecated staring from MongoDB 4.2.

In order to call specific mongo-java-driver specific methods, Liquibase turned to be the most feasible tool to extend as it allows to define change sets to fit driver methods arguments.

Release Notes

4.3.1.1

4.3.1

4.2.2.1

4.2.2

  • Support for Liquibase 4.2.2

4.2.1

  • Support for Liquibase 4.2.1

4.1.1.2

{
    "options" : 
        {
            "$rawJson" : { ... }
        }
}

For the command line is required to copy to [liquibase]/lib libraries : jackson-annotations-2.11.3.jar, jackson-core-2.11.3.jar, jackson-databind-2.11.3.jar

  • New properties added
# If disabled can be used on API which do not support validators (Azure Cosmos DB with Mongo API, Amazon DocumentDB)
liquibase.mongodb.supportsValidator=true
# If enabled will adjust indexes and validators for Liquibase tracking tables LOCK and CHANGELOG. Can be disabled if sure Liquibase not updated.
liquibase.mongodb.adjustTrackingTablesOnStartup=true
  • Overridden Liquibase table names removed. Now will be used the default ones in Liquibase. If previous releases used then table names should be explicitly passed as parameters. Currently, by default as Liquibase default :DATABASECHANGELOGLOCK, DATABASECHANGELOG Previous releases used by default : databaseChangeLogLock, databaseChangeLog

4.1.1

  • Support for Liquibase 4.1.1

4.1.0

  • Support for Liquibase 4.1.0

4.0.0

  • Works with Liquibase v4.0.0

3.10.0

  • Support for Liquibase 3.10

3.9.0

  • First release

Implemented Changes:

A couple of Changes were implemented until identified that majority of the operations can be achieved using db.runCommand() and db.adminCommand()

Connection String Formats

mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]] mongodb://mongodb1.example.com:27317,mongodb2.example.com:27017/?replicaSet=mySet&authSource=authDB

mongodb+srv://[username:password@]host[/[database][?options]] mongodb+srv://server.example.com/ mongodb+srv://:@cluster0.example.com/testdb?authSource=$external&authMechanism=MONGODB-AWS

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Dependencies that have to be available in classpath if run via Liquibase CLI
mongodb-driver-sync:4.2.0
snakeyaml:1.27
jackson-annotations:2.11.3
jackson-core:2.11.3
jackson-databind:2.11.3

Installing

  • Clone the project
git clone https://github.com/liquibase/liquibase-mongodb

Running tests

Adjust connection string

Connection url can be adjusted here: url Connection String Format Run Integration tests by enabling run-its profile

Run integration tests

mvn clean install -Prun-its

Run integration test driver backward compatibility

  1. Produce test containing jar
mvn clean install -Ptest-jar
  1. Go to test-project
cd test-project
  1. Run backward compatibility test with provided 3x driver
mvn clean install -Prun-its,mongo-3x

Quick Start Examples

Quick start Application for NoSql liquibase extensions

Integration

Add dependency:

<dependency>
    <groupId>org.liquibase.ext</groupId>
    <artifactId>liquibase-mongodb</artifactId>
    <version>${liquibase-mongodb.version}</version>
</dependency>

Java call:

public class Application {
    public static void main(String[] args) {
        MongoLiquibaseDatabase database = (MongoLiquibaseDatabase) DatabaseFactory.getInstance().openDatabase(url, null, null, null, null);
        Liquibase liquibase = new Liquibase("liquibase/ext/changelog.generic.test.xml", new ClassLoaderResourceAccessor(), database);
        liquibase.update("");
    }
}

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE.md file for details

liquibase-mongodb's People

Contributors

r2-lf avatar dependabot-preview[bot] avatar alexandru-slobodcicov avatar mcred avatar jsonking avatar nvoxland avatar dependabot[bot] avatar liquibot avatar tabuckner avatar szandany avatar molivasdat avatar gobozov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.