{"id":20738804,"url":"https://github.com/ebean-orm/ebean-migration","last_synced_at":"2025-08-20T21:10:06.982Z","repository":{"id":8622616,"uuid":"59083767","full_name":"ebean-orm/ebean-migration","owner":"ebean-orm","description":"DB Migration runner (similar to Flyway) which can be used standalone or with Ebean (run migrations on EbeanServer start)","archived":false,"fork":false,"pushed_at":"2024-07-02T10:48:54.000Z","size":507,"stargazers_count":9,"open_issues_count":6,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-24T02:09:18.657Z","etag":null,"topics":["database","database-migrations","flyway","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ebean-orm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-18T05:10:27.000Z","updated_at":"2024-07-02T10:48:58.000Z","dependencies_parsed_at":"2023-01-11T17:26:03.591Z","dependency_job_id":"f473ed41-e85a-484e-b609-ecc3dc2982f6","html_url":"https://github.com/ebean-orm/ebean-migration","commit_stats":null,"previous_names":[],"tags_count":87,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebean-orm%2Febean-migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebean-orm","download_url":"https://codeload.github.com/ebean-orm/ebean-migration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546082,"owners_count":21448260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-migrations","flyway","java"],"created_at":"2024-11-17T06:20:44.416Z","updated_at":"2025-04-24T02:09:30.752Z","avatar_url":"https://github.com/ebean-orm.png","language":"Java","readme":"[![Build](https://github.com/ebean-orm/ebean-migration/actions/workflows/build.yml/badge.svg)](https://github.com/ebean-orm/ebean-migration/actions/workflows/build.yml)\n[![Maven Central : ebean](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean-migration/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.ebean/ebean-migration)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ebean-orm/ebean-migration/blob/master/LICENSE)\n[![JDK EA](https://github.com/ebean-orm/ebean-migration/actions/workflows/jdk-ea.yml/badge.svg)](https://github.com/ebean-orm/ebean-migration/actions/workflows/jdk-ea.yml)\n[![native image build](https://github.com/ebean-orm/ebean-migration/actions/workflows/native-image.yml/badge.svg)](https://github.com/ebean-orm/ebean-migration/actions/workflows/native-image.yml)\n\n# Ebean Migration\nDB Migration runner (similar to FlywayDB) which can be used standalone or with Ebean (to run DB Migrations on EbeanServer start)\n\n## Example use\nTo use firstly create a MigrationConfig and set properties, then create and run MigrationRunner.\n```java\n    MigrationConfig config = new MigrationConfig();\n    config.setDbUsername(\"sa\");\n    config.setDbPassword(\"\");\n    config.setDbUrl(\"jdbc:h2:mem:db1\");\n\n    // or load from Properties\n    Properties properties = ...\n    config.load(properties);\n\n    // run it ...\n    MigrationRunner runner = new MigrationRunner(config);\n    runner.run();\n```\nThen create a run a MigrationRunner. When running the database connection can either be:\n- Passing a Connection explicitly\n- Creating a connection (by specifying JDBC Driver and URL on MigrationConfig)\n- Passing a DataSource (MigrationConfig dbUsername and dbPassword used)\n\n### Run with explicit connection\n```java\n    Connection connection = ...;\n\n    MigrationRunner runner = new MigrationRunner(config);\n\n    // pass explicit connection\n    runner.run(connection);\n```\n\n### Run with explicit DataSource\n```java\n    DataSource dataSource = ...;\n\n    MigrationRunner runner = new MigrationRunner(config);\n\n    // pass a dataSource\n    runner.run(dataSource);\n```\n\n### Run creating a Connection (via MigrationConfig)\n```java\n    MigrationRunner runner = new MigrationRunner(config);\n    runner.run();\n```\n\n## Notes:\nMigrationConfig migrationPath is the root path (classpath or filesystem) where the migration scripts are searched for.\n\n```java\n    MigrationConfig config = createMigrationConfig();\n\n    // load .sql migration resources from a file system location\n    config.setMigrationPath(\"filesystem:my-directory/dbmigration\");\n```\n\nDB Migration runner follows the FlywayDB conventions and supports running \"Versioned\" migrations and \"Repeatable\" migrations.\n\n```console\ndbmigration\ndbmigration/1.1__initial.sql\ndbmigration/1.2__add_some_stuff.sql\ndbmigration/R__create_views_repeatable.sql\n```\n\"Repeatable migrations\" start with `R__` and execute if they have not been or if their content has changed (using a Md5 checksum).\n\n\"Version migrations\" start with `V` (or not) and have a version number (1.2 etc) followed by double underscore `__` and then a comment.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febean-orm%2Febean-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febean-orm%2Febean-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febean-orm%2Febean-migration/lists"}