All Projects → KenjiOhtsuka → harmonica

KenjiOhtsuka / harmonica

Licence: MIT license
Kotlin Database Migration Tool. This tool makes it really easy to create table, index, add columns, and so on, with Kotlin DSL.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to harmonica

Laravel Sync Migration
Developer tool helps to sync migrations without refreshing the database
Stars: ✭ 89 (-27.64%)
Mutual labels:  migration, database-migrations
carry
Python ETL(Extract-Transform-Load) tool / Data migration tool
Stars: ✭ 115 (-6.5%)
Mutual labels:  migration, database-migrations
Yii2 Migration
Yii 2 Migration Creator And Updater
Stars: ✭ 262 (+113.01%)
Mutual labels:  migration, database-migrations
upscheme
Database migrations and schema updates made easy
Stars: ✭ 737 (+499.19%)
Mutual labels:  migration, database-migrations
Dbmate
🚀 A lightweight, framework-agnostic database migration tool.
Stars: ✭ 2,228 (+1711.38%)
Mutual labels:  migration, database-migrations
r2dbc-migrate
R2DBC database migration tool & library
Stars: ✭ 83 (-32.52%)
Mutual labels:  migration, database-migrations
Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+1617.07%)
Mutual labels:  migration, database-migrations
migrations
Migrations is a database migration tool that uses go's database/sql from the standard library
Stars: ✭ 17 (-86.18%)
Mutual labels:  migration, database-migrations
couchmove
Java data migration tool for Couchbase
Stars: ✭ 36 (-70.73%)
Mutual labels:  migration
kmp-fatframework-cocoa
A Gradle plugin to generate and publish an iOs FatFramework or XCFramework on Kotlin Multiplatform projects.
Stars: ✭ 26 (-78.86%)
Mutual labels:  gradle-plugin
gradle-semantic-build-versioning
Gradle plugin to generate version-numbers and tags using semantic versioning
Stars: ✭ 19 (-84.55%)
Mutual labels:  gradle-plugin
sqflite migration
Library to manage sqlite db migrations.
Stars: ✭ 40 (-67.48%)
Mutual labels:  database-migrations
gradle-cpd-plugin
Gradle plugin to find duplicate code using PMDs copy/paste detection (= CPD).
Stars: ✭ 88 (-28.46%)
Mutual labels:  gradle-plugin
migrant
Migration management for PostgreSQL/SQLite/MySQL
Stars: ✭ 85 (-30.89%)
Mutual labels:  database-migrations
django-wordpress-parser
Wordpress eXtended RSS Parser (in Python for Django)
Stars: ✭ 18 (-85.37%)
Mutual labels:  migration
modoboa-imap-migration
An extension to ease the migration between 2 IMAP servers using offlineimap
Stars: ✭ 14 (-88.62%)
Mutual labels:  migration
dmn-check
A tool which performs static analyses on Decision Model Notation (DMN) files to detect bugs
Stars: ✭ 34 (-72.36%)
Mutual labels:  gradle-plugin
boost
Boost Maven and Gradle plugins for MicroProfile development
Stars: ✭ 27 (-78.05%)
Mutual labels:  gradle-plugin
GradleMongoPlugin
Gradle plugin for running a managed instance of Mongo.
Stars: ✭ 48 (-60.98%)
Mutual labels:  gradle-plugin
neo4j-migrations
Automated script runner aka "Migrations" for Neo4j. Inspired by Flyway.
Stars: ✭ 82 (-33.33%)
Mutual labels:  database-migrations

This Library is NOT developed actively now. Please feel free to fork, develop and publicize your library.

Harmonica - Kotlin Database Migration Tool

License: MIT Download CircleCI Twitter Follow

Gradle Plugin Page: https://plugins.gradle.org/plugin/com.improve_future.harmonica

This is Database Migration Tool, gradle plugin, made with Kotlin. It is made similar to Phinx, Rails.

Now, this tool is for PostgreSQL, MySQL, SQLite and Oracle Database.

Overview

With this library, you can write database migration like as follows.

package your.migration

import com.improve_future.harmonica.core.AbstractMigration

/**
 * HolloWorld
 */
class M20180624011127699_HolloWorld : AbstractMigration() {
    override fun up() {
        createTable("table_name") {
            // If you add the next line,
            // the migration doesn't create auto incremental id column.
            // id = false

            // You can easily define columns with their type name.
            boolean("boolean_column", nullable = false, default = true)
            integer("integer_column", default = 1)
            decimal("decimal_column", 5, 2, default = 3)
            varchar("varchar_column", size = 10, nullable = false)
            text("text_column", default = "default value")
            blob("blob_column", default = "abcde".toByteArray())
            date("date_column_1", default = "2019-01-01")
            date("date_column_2", default = Date())
            date("date_column_3", default = LocalDate.of(2018, 2, 2))
            time("time_column_1", default = "11:22:33")
            time("time_column_2", default = Date())
            time("time_column_3", default = LocalTime.now(), nullable = false)
            dateTime("date_tiem_column_1", default = "2011-11-12 12:34:56")
            dateTime("date_time_column_2", default = Date())
            dateTime("date_time_column_3", default = LocalDateTime.now())
            timestamp("timestamp_column_1", default = "2012-10-04 1:2:3")
            timestamp("timestamp_column_2", default = Date())
            timestamp("timestamp_column_3", default = LocalDateTime.now())
        }

        // When you add column, `add*****Column` method works.
        addBooleanColumn(
            "table_name", "added_boolean",
            default = true, nullable = false
        )
        addIntegerColumn(
            "table_name", "added_integer", nullable = false
        )
        addDecimalColumn("table_name", "added_decimal_column_name")
        addVarcharColumn(
            "table_name", "added_boolean_column_name",
            default = "default", nullable = false
        )
        addTextColumn("table_name", "added_text_column_name")
        addDateColumn(
            "table_name", "added_date",
            default = LocalDate.of(2018, 12, 11)
        )

        // When you add index, use `addIndex`.
        createIndex("table_name", "column_name")

        // You can execute SQL directly.
        executeSql("SELECT 1;")
    }

    override fun down() {
        dropIndex("table_name", "table_name_integer_column_idx")
        dropTable("table_name")
    }
}

Usage, Command

Caution

When you use harmonica, not jarmonica, sometimes it says "The connection has already been closed" and the migrations fail. Then, execute gradlew --stop to clear dead connections.

Contribute

Pull requests are welcomed!! Please feel free to use it, and to contribute.

Links

Test Project

Test with real database is in different repository, Harmonica Test.

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