{"id":18250530,"url":"https://github.com/dropwizard/dropwizard-flyway","last_synced_at":"2025-04-04T16:31:25.375Z","repository":{"id":16243429,"uuid":"18991180","full_name":"dropwizard/dropwizard-flyway","owner":"dropwizard","description":"Addon bundle for Dropwizard to support Flyway for database migrations","archived":false,"fork":false,"pushed_at":"2024-04-13T03:01:18.000Z","size":1754,"stargazers_count":60,"open_issues_count":1,"forks_count":27,"subscribers_count":8,"default_branch":"release/4.0.x","last_synced_at":"2024-04-14T00:21:47.614Z","etag":null,"topics":["database-migrations","dropwizard","flyway"],"latest_commit_sha":null,"homepage":"https://dropwizard.github.io/dropwizard-flyway/","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/dropwizard.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}},"created_at":"2014-04-21T11:58:37.000Z","updated_at":"2024-04-15T08:47:45.259Z","dependencies_parsed_at":"2023-12-25T05:28:22.673Z","dependency_job_id":"a73fb795-b3d7-4a6d-8a0b-f209fdf78443","html_url":"https://github.com/dropwizard/dropwizard-flyway","commit_stats":null,"previous_names":["joschi/dropwizard-flyway"],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropwizard%2Fdropwizard-flyway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropwizard%2Fdropwizard-flyway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropwizard%2Fdropwizard-flyway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dropwizard%2Fdropwizard-flyway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dropwizard","download_url":"https://codeload.github.com/dropwizard/dropwizard-flyway/tar.gz/refs/heads/release/4.0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247209366,"owners_count":20901763,"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-migrations","dropwizard","flyway"],"created_at":"2024-11-05T09:45:01.127Z","updated_at":"2025-04-04T16:31:25.076Z","avatar_url":"https://github.com/dropwizard.png","language":"Java","readme":"Dropwizard Flyway\n=================\n\n[![Build](https://github.com/dropwizard/dropwizard-flyway/actions/workflows/build.yml/badge.svg)](https://github.com/dropwizard/dropwizard-flyway/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dropwizard_dropwizard-flyway\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=dropwizard_dropwizard-flyway)\n[![Maven Central](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway.svg)](https://search.maven.org/artifact/io.dropwizard.modules/dropwizard-flyway)\n\n`dropwizard-flyway` is a set of commands using [Flyway](http://www.flywaydb.org/) for database migrations in [Dropwizard](http://dropwizard.io/) applications.\n\n\nUsage\n-----\n\nJust add the `FlywayBundle` to your Dropwizard application inside the [`Application#initialize`](https://javadoc.io/static/io.dropwizard/dropwizard-core/4.0.0/io/dropwizard/core/Application.html#initialize(io.dropwizard.core.setup.Bootstrap) method.\n\n    @Override\n    public void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n        // ...\n        bootstrap.addBundle(new FlywayBundle\u003cMyConfiguration\u003e() {\n            @Override\n            public DataSourceFactory getDataSourceFactory(MyConfiguration configuration) {\n                return configuration.getDataSourceFactory();\n            }\n            \n            @Override\n            public FlywayFactory getFlywayFactory(MyConfiguration configuration) {\n                return configuration.getFlywayFactory();\n            }\n        });\n    }\n\n\nAfter that you can use one of the following Flyway commands:\n\n| Command       | Description                                                                  |\n| ------------- | ---------------------------------------------------------------------------- |\n| `db migrate`  | Migrates the database                                                        |\n| `db clean`    | Drops all objects in the configured schemas                                  |\n| `db info`     | Prints the details and status information about all the migrations           |\n| `db validate` | Validates the applied migrations against the ones available on the classpath |\n| `db init`     | Creates and initializes the metadata table (existing database)               |\n| `db repair`   | Repairs the metadata table                                                   |\n\nThe [Flyway migrations](http://flywaydb.org/documentation/migration/) must be accessible in the classpath under `db/migration` (or any other path configured with the `locations` parameter, see [FlywayFactory](https://dropwizard.github.io/dropwizard-flyway/2.0.0-1/apidocs/io/dropwizard/flyway/FlywayFactory.html)).\n\n\nConfiguration\n-------------\n\n`dropwizard-flyway` is using the standard [DataSourceFactory](https://javadoc.io/static/io.dropwizard/dropwizard-db/4.0.0/io/dropwizard/db/DataSourceFactory.html) from [`dropwizard-db`](https://javadoc.io/doc/io.dropwizard/dropwizard-db/4.0.0/index.html) for configuring its [DataSource](http://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html).\n\nAdditionally, you can override the following configuration settings of Flyway using [FlywayFactory](https://dropwizard.github.io/dropwizard-flyway/2.0.0-1/apidocs/io/dropwizard/flyway/FlywayFactory.html):\n\n    flyway:\n      # The encoding of SQL migrations. (default: UTF-8) \n      encoding: UTF-8\n\n      # The maximum number of retries when attempting to connect to the database. (default: 0)\n      connectRetries: 0\n\n      # The maximum time between retries when attempting to connect to the database in seconds. (default: 120)\n      connectRetriesInterval: 120\n\n      # The default schema managed by Flyway. (default: the first schema listed in schemas)\n      defaultSchema:\n      \n      # The schemas managed by Flyway. (default: default schema of the connection)\n      schemas:\n      \n      # The fully qualified class names of the callbacks for lifecycle notifications. (default: empty list)\n      callbacks:\n      \n      # The name of the schema metadata table that will be used by Flyway. (default: flyway_schema_history)\n      metaDataTableName: flyway_schema_history\n      \n      # The file name prefix for sql migrations (default: V)\n      sqlMigrationPrefix: V\n      \n      # The file name separator for sql migrations (default: __)\n      sqlMigrationSeparator: __\n      \n      # The file name suffixes for sql migrations (default: .sql)\n      sqlMigrationSuffixes:\n        - .sql\n      \n      # The prefix of every placeholder. (default: ${ )\n      placeholderPrefix: ${\n      \n      # The suffix of every placeholder. (default: } )\n      placeholderSuffix: }\n      \n      # The map of \u003cplaceholder, replacementValue\u003e to apply to sql migration scripts. (default: empty map)\n      placeholders:\n      \n      # Locations to scan recursively for migrations. (default: db/migration)\n      locations:\n        - db/migration\n      \n      # The fully qualified class names of the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. (default: empty list)\n      resolvers:\n      \n      # Allows migrations to be run \"out of order\". If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored. (default: false)\n      outOfOrder: false\n      \n      # The description to tag an existing schema with when executing baseline. (default: \u003c\u003c Flyway Baseline \u003e\u003e)\n      baselineDescription: \"\u003c\u003c Flyway Baseline \u003e\u003e\"\n      \n      # Whether to automatically call baseline when migrate is executed against a non-empty schema with no metadata table. (default: false)\n      # Be careful when enabling this as it removes the safety net that ensures Flyway does not migrate the wrong database in case of a configuration mistake!\n      baselineOnMigrate: false\n      \n      # Whether to automatically call validate or not when running migrate. (default: true)\n      validateOnMigrate: true\n      \n      # The version to tag an existing schema with when executing baseline. (default: 1)\n      baselineVersion: 1\n      \n      # Whether to disabled clean. (default: false)\n      # This is especially useful for production environments where running clean can be quite a career limiting move.\n      cleanDisabled: false\n      \n      # Whether to group all pending migrations together in the same transaction when applying them\n      # (only recommended for databases with support for DDL transactions).\n      # true if migrations should be grouped. false if they should be applied individually instead. (default: false)\n      group: false\n      \n      # Ignore migrations that match this list of patterns when validating migrations.\n      # Each pattern is of the form described type:status with * matching type or status.\n      # Please refer to https://documentation.red-gate.com/fd/flyway-cli-and-api/configuration/parameters/flyway/ignore-migration-patterns for details. \n      # Example: repeatable:missing,versioned:pending,*:failed (default: *:future)\n      ignoreMigrationPatterns: \n        - \"*:future\"\n      \n      # The username that will be recorded in the schema history table as having applied the migration.\n      # \u003c\u003cblank\u003e\u003e for the current database user of the connection. (default: \u003c\u003cblank\u003e\u003e).\n      installedBy:\n      \n      # Whether to allow mixing transactional and non-transactional statements within the same migration.\n      # true if mixed migrations should be allowed. false if an error should be thrown instead. (default: false)\n      mixed: false\n      \n      # Whether placeholders should be replaced. (default: true)\n      placeholderReplacement: true\n      \n      # If set to true, default built-in callbacks (sql) are skipped and only custom callback as\n      # defined by 'callbacks' are used. (default: false)\n      skipDefaultCallbacks: false\n      \n      # If set to true, default built-in resolvers (jdbc, spring-jdbc and sql) are skipped and only custom resolvers as\n      # defined by 'resolvers' are used. (default: false)\n      skipDefaultResolvers: false\n\n      # The map of \u003cflywaySetting, appliedValue\u003e to overwrite any existing configuration. (default: empty map)\n      # Properties are documented here: https://documentation.red-gate.com/fd/parameters-224919673.html\n      configuration:\n\n      #### COMMERCIAL FEATURES\n      # (Flyway Pro and Flyway Enterprise only)\n      \n      # Whether to batch SQL statements when executing them. (default: false)\n      batch: false\n      \n      # The file where to output the SQL statements of a migration dry run. If the file specified is in a non-existent\n      # directory, Flyway will create all directories and parent directories as needed.\n      # \u003c\u003cblank\u003e\u003e to execute the SQL statements directly against the database. (default: \u003c\u003cblank\u003e\u003e)\n      #dryRunOutputFile:\n      \n      # Comma-separated list of the fully qualified class names of handlers for errors and warnings that occur during a\n      # migration. This can be used to customize Flyway's behavior by for example throwing another runtime exception,\n      # outputting a warning or suppressing the error instead of throwing a FlywayException.\n      # ErrorHandlers are invoked in order until one reports to have successfully handled the errors or warnings.\n      # If none do, or if none are present, Flyway falls back to its default handling of errors and warnings.\n      # \u003c\u003cblank\u003e\u003e to use the default internal handler (default: \u003c\u003cblank\u003e\u003e)\n      #errorHandlers:\n\n      # Rules for the built-in error handler that lets you override specific SQL states and errors codes from error to\n      # warning or from warning to error.\n      # Each error override has the following format: STATE:12345:W. It is a 5 character SQL state, a colon, the SQL \n      # error code, a colon and finally the desired behavior that should override the initial one. The following \n      # behaviors are accepted: W to force a warning and E to force an error.\n      # For example, to force Oracle stored procedure compilation issues to produce errors instead of warnings,\n      # the following errorOverride can be used: 99999:17110:E\n      #errorOverrides:\n      \n      # Whether to stream SQL migrations when executing them. (default: false)\n      stream: false\n      \n      # Target version up to which Flyway should consider migrations.\n      # The special value 'current' designates the current version of the schema. (default: \u003c\u003clatest version\u003e\u003e)\n      #target:\n\n\nMaven Artifacts\n---------------\n\n![dropwizard-flyway 2.1.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/2.1)\n![dropwizard-flyway 3.0.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/3.0)\n![dropwizard-flyway 4.0.x](https://img.shields.io/maven-central/v/io.dropwizard.modules/dropwizard-flyway/4.0)\n\nThis project is available on Maven Central. To add it to your project simply add the following dependencies to your `pom.xml`:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eio.dropwizard.modules\u003c/groupId\u003e\n      \u003cartifactId\u003edropwizard-flyway\u003c/artifactId\u003e\n      \u003cversion\u003e${dropwizard-flyway.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\nPlease note that you will need to add the respective Flyway database support artifacts and configure them via the `flyway.configuration` map.\n\nExample:\n\nAdd Flyway PostgreSQL dependency to your POM:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eorg.flywaydb\u003c/groupId\u003e\n      \u003cartifactId\u003eflyway-database-postgresql\u003c/artifactId\u003e\n      \u003cversion\u003e${flyway.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\nAdd the configuration setting to your `flyway.configuration` block:\n\n    flyway:\n      configuration:\n        # PostgreSQL Transactional Lock, see https://documentation.red-gate.com/fd/postgresql-transactional-lock-224919738.html\n        flyway.postgresql.transactional.lock: false\n\nSupport\n-------\n\nPlease file bug reports and feature requests in [GitHub issues](https://github.com/dropwizard/dropwizard-flyway/issues).\n\n\nLicense\n-------\n\nCopyright (c) 2014-2024 Jochen Schalanda, Dropwizard Team\n\nThis library is licensed under the Apache License, Version 2.0.\n\nSee http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdropwizard%2Fdropwizard-flyway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdropwizard%2Fdropwizard-flyway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdropwizard%2Fdropwizard-flyway/lists"}