How Add Table on Database When Installation Package

Permalink 1 user found helpful
Hi all,

I wanna add table when Installation package. This is my code:

public function install() {
        $pkg = parent::install();
        // Install the Dashboard Screens
        // In version 5.6, bootstrap icons can be used in the dashboard!
        $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
        $p = SinglePage::add('/dashboard/warna_produk/', $pkg);
        if (is_object($p) && $p->isError() !== false) {
            $p->update(array('cName' => t('Warna Produk'), 
                'cDescription' => 'Manage Warna Produk'));
        $p = SinglePage::add('/dashboard/warna_produk/tambah', $pkg);
        if (is_object($p) && $p->isError() !== false) {

can anyone give me information for that?

thank you

View Replies: View Best Answer
datatainment replied on at Permalink Reply
JohntheFish replied on at Permalink Best Answer Reply
You don't need any code. Just define it in db.xml in the package directory (same place as the controller.php) and c5 will automatically pick it up and create tables when the package is installed.
mhistihori replied on at Permalink Reply
thank you sk01 for reference database...
thank you JohntheFish, you solved my problem.