Giter Club home page Giter Club logo

doomig's Introduction

doomig

Welcome to doomig. It is a migration tool for database schemas.
This is in response to 2 things

  • Tired of migration tools costing money for commonly used features
  • Wanting to dive more into Scala 3

It supports

  • Postgresql (soon it will support MySql)
  • migrations up and down based upon files in a directory following a specific naming convention.
    • This convention can be user defined but must include some named fields in the regex.
  • Dry runs that validate the schema using doobie typechecking

It is definitely still in the beginning days so there will be some movement here and there.

Code Wise

It uses Scala3, doobie with a tagless final style that uses cats-effect.

Run application

Add ddl files for up and down to a directory. By default, you should follow this naming convention for the files. You can override this naming convention by defining your own up and down regex. The regex must have the following named groups.

  • version
  • desc
req Argument Value
Y 0 up or down
Y --source-folder Directory to search migration files for
N --destination-version Version you want to migrate to
N --db-table-name Name of the migration table. Defaults to doomig_version
Y --db-url Jdbc url
Y --db-user database user name
Y --db-password database password
N --db-driver database driver; defaults to org.postgresql.Driver
N --dry-run Only tells you what would run and checks the ddl
N --file-regex Needs to be the regex for the --direction specified (up, down)
Y --help Prints out the help

Up to date values are defined in Conf.scala

sbt run app/run

Run Unit tests tests

sbt core/test

doomig's People

Contributors

strad234 avatar rstradling avatar

Watchers

 avatar

doomig's Issues

Logging output issues

Currently because the logger is passed in at the top level down into the doobie layer the name used for the logger is com.strad.doomig.app.*. This causes issues when wanting to silence the verbose output of doobie but keep the logging for com.strad.doomig.app Main ...i.e. standard console logging.

There are two possible solutions to this problem

  1. Create a new logger with a name that mirrors the lowerlevel VersionDb class.
  2. Just use println logging for things at the main level that we definitely want to print out.

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.