Skip to content

Commit f7f557e

Browse files
authored
Merge pull request #416 from akshaysonvane/dev
Delete user schemas from user schemas database only
2 parents 92c9d07 + cabc11f commit f7f557e

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip

src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,29 @@ class MarkLogicTask extends DefaultTask {
4444
project.hasProperty("mlAdminPassword") ? project.property("mlAdminPassword") : project.property("mlPassword")
4545
}
4646

47+
DatabaseClient newClient() {
48+
newClient(null)
49+
}
50+
4751
/**
48-
* If the "database" property is set, then the DatabaseClient that's returned will use the App-Services port
49-
* (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will try to connect to the
50-
* REST API server defined by mlRestPort.
52+
* If the "database" property is set or is passed as a parameter, then the DatabaseClient that's returned will use
53+
* the App-Services port (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will
54+
* try to connect to the REST API server defined by mlRestPort.
5155
* @return
5256
*/
53-
DatabaseClient newClient() {
54-
if (project.hasProperty("database")) {
57+
DatabaseClient newClient(String database) {
58+
if (database != null){
59+
println "Connecting via the App-Services port to database: " + database
60+
return getAppConfig().newAppServicesDatabaseClient(database)
61+
}
62+
else if (project.hasProperty("database")) {
5563
println "Connecting via the App-Services port to database: " + project.property("database")
5664
return getAppConfig().newAppServicesDatabaseClient(project.property("database"))
5765
}
5866
else {
5967
getAppConfig().newDatabaseClient()
6068
}
61-
}
69+
}
6270

6371
void deployWithCommandListProperty(String propertyName) {
6472
deployWithCommands(getProject().property(propertyName))

src/main/groovy/com/marklogic/gradle/task/databases/DeleteUserSchemasTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DeleteUserSchemasTask extends MarkLogicTask {
3131
String fullQuery = "cts:uris((), (), " + xquery + ") ! xdmp:document-delete(.)"
3232
println "Deleting user schemas in database '" + database + "' via : " + fullQuery
3333

34-
def client = newClient()
34+
def client = newClient(database)
3535
try {
3636
client.newServerEval().xquery(fullQuery).eval()
3737
} finally {

0 commit comments

Comments
 (0)