Module Installers¶
Most modules will need some kind of installation procedure. This document explains how to create them.
Module installer files are located in modules/argentum/<module_dir>/libraries/<module_name>_install.php
Inside this file, the class name must be <Module_name>_Install. Inside this class the method run_install() must exist for installation procedures, and uninstall() must exist for uninstall procedures.
Example:
For a module called "work order":
modules/argentum/work_order/libraries/work_order_install.php
<?php
class Work_Order_Install
{
public function run_install()
{
Database::instance()->query('CREATE TABLE `'.Kohana::config('database.default.table_prefix').'work_orders` (...)');
}
public function uninstall()
{
Database::instance()->query('DROP TABLE `'.Kohana::config('database.default.table_prefix').'work_orders`');
}
}
Note that when you are specifying manual SQL queries, you must use the config item for the table prefix.