marklogic-community / roxy

Deployment tool for MarkLogic applications. Also provides optional unit test and XQuery MVC structure
Other
87 stars 66 forks source link

Wiping databases with cross-dependencies fails #814

Open grtjn opened 7 years ago

grtjn commented 7 years ago

Wipe sometimes fails to wipe databases, because there are still dependencies. You'll get messages like:

Wiping MarkLogic setup for your project from ml9-ml1...
ERROR: ADMIN-DATABASEINUSE: (err:FOER0000) The following databases still refer to this database as their triggers database: roxy-test.
See MarkLogic Server error log for more details.
ERROR: ... Wipe FAILED
grtjn commented 7 years ago

We need to detach security, schemas, and triggers before deleting a database. Add the following to setup:delete-databases:

      let $admin-config := admin:database-set-schema-database($admin-config, $db-id, $default-schemas)
      let $admin-config := admin:database-set-security-database($admin-config, $db-id, $default-security)
      let $admin-config := admin:database-set-triggers-database($admin-config, $db-id, 0)