Gradle-DatabasePlugin V1.0.12

au.com.coherentsoftware.gradle.database.task
[Groovy] Class DbInit

java.lang.Object
  org.gradle.api.DefaultTask
      au.com.coherentsoftware.gradle.database.task.DbBaseTask
          au.com.coherentsoftware.gradle.database.task.DbInit

class DbInit
extends DbBaseTask

Gradle Task to initialise a database from a file containing SQL statements. Database user must have appropriate permissions. See the DatabasePlugin documentation for sample use.

See Also:
DatabasePlugin


Property Summary
def dataFile

String database

 
Method Summary
File getDataFile()

Convert datafile to a File object, using Project's file().

String getDescription()

Customises the description of this task according to the datafile it is to load, and the database it is to update.

def importSql()

Use the mysql client (which must be on the path) to invoke the SQL statements in the specified datafile against the specified database.

 

Property Detail

dataFile

def dataFile


database

String database


 
Method Detail

getDataFile

File getDataFile()
Convert datafile to a File object, using Project's file(). Ensures interpretation of datafile location is delayed until needed.
Returns:
a File object representing the datafile to be loaded.


getDescription

String getDescription()
Customises the description of this task according to the datafile it is to load, and the database it is to update. Makes it easy to work out which task you want to call when there are several different DbInit type tasks.
Returns:
A String with the relevant description.


importSql

@TaskAction
def importSql()
Use the mysql client (which must be on the path) to invoke the SQL statements in the specified datafile against the specified database. The specified username and password must belong to a user who already has permission to take the specified actions on the specified database. The specified database must already exist.


 

Copyright 2014 Coherent Software Australia Pty Ltd