PHP code example of cheukpang / think-migration

1. Go to this page and download the library: Download cheukpang/think-migration 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/ */

    

cheukpang / think-migration example snippets


   case static::PHINX_TYPE_INTEGER:
       if ($limit && $limit >= static::INT_TINY) {
           $sizes = array(
               // Order matters! Size must always be tested from longest to shortest!
               'bigint'    => static::INT_BIG,
               'int'       => static::INT_REGULAR,
               'mediumint' => static::INT_MEDIUM,
               'smallint'  => static::INT_SMALL,
               'tinyint'   => static::INT_TINY,
           );
           $limits = array(
                // 修改部分开始########
               'smallint'  => 5,
                // 修改部分结束########
               'int'       => 11,
               'bigint'    => 20,
           );
           foreach ($sizes as $name => $length) {
               if ($limit >= $length) {
                   $def = array('name' => $name);
                   if (isset($limits[$name])) {
                       $def['limit'] = $limits[$name];
                   }
                   return $def;
               }
           }
       } elseif (!$limit) {
           $limit = 11;
       }
       return array('name' => 'int', 'limit' => $limit);
       break;
    // 后面是添加部分
   case static::PHINX_TYPE_SMALL_INTEGER:
       return array('name' => 'smallint', 'limit' => 5);
       break;