How to use [magic.modules.ensure-database]

This slot ensures that a module’s database exists by invoking its associated create database SQL file. The slot requires the following arguments.

  • [module] - Name of module
  • [database] - Name of database to check for
  • [database-type] - Optional type of database. If not specified defaults to the default database type

The slot basically checks to see if the specified [database] database exists, and if not, attempts to find its associated “xxx.yyy.sql” script within its folder, where “xxx” is the module name and “yyy” is the default database type. The slot will also automatically execute any migration scripts associated with the module. Notice, the “Ensure database” macro in “Hyper IDE” automatically takes care of wiring up invocations to this slot, creating the required structure in the process.