Giter VIP home page Giter VIP logo

codeigniter-migration-generator's Introduction

codeigniter-migration-generator's People

Contributors

corvenik-ian avatar xdn27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

codeigniter-migration-generator's Issues

type ENUM end SET need extra handle

must add new function to handle enum and set

/**
     * Method _extra_enum_set_handle
     *
     * @param $string $string [explicite description]
     *
     * @return String
     */
public function _extra_enum_set_handle($string = null)
    {
        $find = ['/(^\w+\(?)/', '/(\)$)/'];  // reg 'a(' or ')'
        $replace_type = preg_replace($find, '', $string); /// replace first string of type ex set('es','ea') or enum('1','11')
        return $replace_type;
    }

in function get_function_up_content change to:

if (!isset($match[2])) {
                switch (strtoupper($match[0])) {
                        //type enum need extra handle
                    case 'ENUM':
                        $add_field_str .= "\t\t\t\t'constraint' => [" . $this->_extra_enum_set_handle($column['Type']) . "],\n";
                        break;
                    // Add SET type
                    case 'SET':
                        $add_field_str .= "\t\t\t\t'constraint' => [" . $this->_extra_enum_set_handle($column['Type']) . "],\n";
                        break;
                    default:
                        $add_field_str .= "\t\t\t\t'constraint' => '" . strtoupper($column['Type']) . "'," . "\n";
                        break;
                }
            }

on Line 320
constraint is number

       else{
                /// constraint not number 
                if(is_numeric($match[2])){
                    $add_field_str .= "\t\t\t\t'constraint' => '" . strtoupper($match[2]) . "'," . "\n";
                }
            }

RESULT:

            'field' => array(
                'type' => 'SET',
                'constraint SET' => ['aaa','bbb','ccc','ddd','ffff'],
            ),

Database Name Change

$migration_table_set[] = $table_info['Tables_in_chentron']
to
$migration_table_set[] = $table_info['Tables_in_'.$this->_db_name.''];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.