PHP code example of tumtum / oxid-schema-expander

1. Go to this page and download the library: Download tumtum/oxid-schema-expander library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tumtum / oxid-schema-expander example snippets


     public static function onModuleActivation()
     {
         $desire = new DesireExpander();

         // Simple create new table
         $desire
             ->table('tm_example')
                 ->addFieldOxid()
                 ->addFieldOxactive()
                 ->addFieldOxactiveFrom()
                 ->addFieldOxactiveTo()
                 ->addField('OXHASH', "char(32) COLLATE latin1_general_ci NOT NULL DEFAULT '' COMMENT 'Hash'")
                 ->addField('OXTIME', "int(11) NOT NULL COMMENT 'Validation time'")
                 ->addFieldOxtimestamp()
                 ->setPrimaryKey('OXID');

         // Extent a oxarticles table
         $desire
             ->table('oxarticles')
                 ->addField('MYCOLUMN', "char(32) NOT NULL DEFAULT 'Wowo' COMMENT 'Extent only one Column'")
                 ->after('oxlang');

         // A standard oxid-ee table
         $desire
             ->table('tm_example_enterprice')
                 ->addFieldOxid()
                 ->addFieldOxshopid()
                 ->addFieldOxlang()
                 ->addField('OXHASH', "char(32) COLLATE latin1_general_ci NOT NULL DEFAULT '' COMMENT 'Hash'")
                 ->addField('OXTIME', "int(11) NOT NULL COMMENT 'Validation time'")
                 ->addFieldOxtimestamp()
                 ->setPrimaryKey('OXID')
                 ->addKey('FASTFIND', [['OXHASH', 12], 'OXTIME']);

         //Commit all Tables
         $desire->execute();
     }