GithubHelp home page GithubHelp logo

lordlothar99 / mx-migration Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 39.17 MB

Database migration module for Mendix

License: Apache License 2.0

JavaScript 12.26% Java 0.23% HTML 2.14% CSS 38.27% SCSS 47.09%
mendix migration database database-migrations mendix-module

mx-migration's Introduction

Database migration for Mendix

This module allows data migration which is not supported by Mendix. The migration should be executed when application starts, but it's possible to do it anytime. Inspired by Liquibase, simplified for Mendix.

Use case

If you make some changes in your model (creation of new entities, or re-organization of existing entities for example), it's usually necessary to migrate the data : a new table should be filled with data coming from an older table. This module let you create migration microflow which are executed once per database.

Usage

Add microflow "Act_Migrate" at the beginning of your after-startup microflow. Define:

  • the module where your migration microflows are set (or leave it empty if you want the migration module to scan your whole project)
  • the prefix of your migration microflows ("Mig_" could be a good choice) The migration will occur in alphabetical order. The execution of a migration microflow is stored in the database, so they're executed only one per database. It's generally recommended to keep the migration microflow in your project, so it's possible to setup a new database from scratch, but you can also delete the old migration microflows once all your databases have been migrated.

The table "Script" contains the timestamp of all script executions, and their order.

Update of migration microflow name or module

In case you want to change the name of a migration microflow or the module where you store them, you'll have to update the "Script" table, and update the parameters sent to "Act_Migrate". It's indeed a good example of a scenario where we would need a migration script :)

Errors during migration

If a migration microflow fails to execute, the migration process stop there (the app won't start if you added "Act_Migrate" in your after-startup microflow). It will let you fix the issue either in the database or in the migration microflow itself. When you'll restart the app, the process restarts from the last "success" execution.

Force the re-execution of a migration microflow

If you want to re-execute a migration microflow, you'll have to erase "Started" and "Finished" fields in the database, and restart the migration process.

Example

An example project is available in github.

Version

Mendix 9

Feedback, PR & bugs

Please submit your bugs / PR here, and contact me at "francois at kohomai.com"

mx-migration's People

Contributors

lordlothar99 avatar

Watchers

 avatar  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.