Skip to content
Drop, create and initialize database schema via REST
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
grails-app
src/groovy/org/grails/plugin/db
test/unit/org/grails/plugin/db/helper/rest
.gitignore
DbHelperRestGrailsPlugin.groovy
README.md
application.properties

README.md

DB Helper - REST

Provides methods for dropping, creating and initialization of database schema from the project bootstrap. For example, you can call dbHelper/dropCreateInit after each end-to-end test to have the fresh data in the database.

You have to exclude this plugin in production mode since the plugin is meant to be used only in development or test environments. In Config.groovy:

environments {
    production {
        grails.plugin.excludes = ['db-helper-rest']
    }
}

Usage

The plugin provides methods that are exposed via REST API (use GET). It makes possible to:

  • drop database schema
    • http://localhost:8080/your-app/dbHelper/drop
  • create database schema
    • http://localhost:8080/your-app/dbHelper/create
  • call init closure from the project BootStrap.groovy
    • http://localhost:8080/your-app/dbHelper/init
  • drop and create database schema
    • http://localhost:8080/your-app/dbHelper/dropCreate
  • drop and create database schema and call init closure from the project BootStrap.groovy
    • http://localhost:8080/your-app/dbHelper/dropCreateInit

Install

Add a dependency for the plugin in BuildConfig.groovy:

plugins {
   ...
   runtime ":db-helper-rest:0.1"
}
You can’t perform that action at this time.