Databases.php
protected function active()
    {
        if( empty($activeDatabaseList = $this->getActiveDatabaseList()) )
        {
            return false;
        }

        $this->setActiveDatabaseEncoding($encoding);

        $status = false;

        $tableKeyColumnDesignData = $this->getTableKeyColumnDesignData();
        
        foreach( $activeDatabaseList as $database )
        {
            $this->forge->createDatabase($database, $encoding);

            if( ! empty($activeTableList = $this->getTableListByActiveDatabase($database)) )
            {
                $dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
                $db      = $this->getDBDifferentConnectionByDatabaseName($database);

                foreach( $activeTableList as $table )
                {
                    $activeTableColumnSchema = $this->getActiveTableColumnSchema($database, $table);

                    $this->addIdColumnToActiveTableIfNotExists($activeTableColumnSchema);

                    $activeTableColumns = $this->getActiveTableColumns($table = $this->getTableNameWithoutExtension($table), $db);

                    $this->getActiveTableKeyAndColumns($activeTableColumns, $activeTableKey, $activeTableColumns);

                    $currentTableKey = $this->getCurrentTableKey($table, $activeTableColumnSchema);

                    if( ! empty($activeTableColumns) )
                    {
                        $columnsMerge = array_merge(array_flip($activeTableColumns), $activeTableColumnSchema);

                        foreach( $columnsMerge as $key => $val )
                        {
                            if( is_numeric($val) )
                            {
                                $this->dropColumnFromActiveTable($table, $key, $dbForge, $status);
                            }
                            elseif( in_array($key, $activeTableColumns) )
                            {
                                $this->modifyColumnFromActiveTable($table, $key, $val, $dbForge, $status, $activeTableKey, $currentTableKey);
                            }
                            else
                            {
                                $this->addColumnFromActiveTable($table, $key, $val, $dbForge, $status);
                            }
                        }

                        if( $status === true )
                        {
                            $this->addTableToArchive($database, $table);
                        }
                    }
                    else
                    {
                        $activeTableColumnSchema[$currentTableKey] = $tableKeyColumnDesignData;

                        $dbForge->createTable($table, $activeTableColumnSchema);
                    }
                }
            }
        }
    }
protected function active()
    {
        if( empty($activeDatabaseList = $this->getActiveDatabaseList()) )
        {
            return false;
        }

        $this->setActiveDatabaseEncoding($encoding);

        $status = false;

        $tableKeyColumnDesignData = $this->getTableKeyColumnDesignData();
        
        foreach( $activeDatabaseList as $database )
        {
            $this->forge->createDatabase($database, $encoding);

            if( ! empty($activeTableList = $this->getTableListByActiveDatabase($database)) )
            {
                $dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
                $db      = $this->getDBDifferentConnectionByDatabaseName($database);

                foreach( $activeTableList as $table )
                {
                    $activeTableColumnSchema = $this->getActiveTableColumnSchema($database, $table);

                    $this->addIdColumnToActiveTableIfNotExists($activeTableColumnSchema);

                    $activeTableColumns = $this->getActiveTableColumns($table = $this->getTableNameWithoutExtension($table), $db);

                    $this->getActiveTableKeyAndColumns($activeTableColumns, $activeTableKey, $activeTableColumns);

                    $currentTableKey = $this->getCurrentTableKey($table, $activeTableColumnSchema);

                    if( ! empty($activeTableColumns) )
                    {
                        $columnsMerge = array_merge(array_flip($activeTableColumns), $activeTableColumnSchema);

                        foreach( $columnsMerge as $key => $val )
                        {
                            if( is_numeric($val) )
                            {
                                $this->dropColumnFromActiveTable($table, $key, $dbForge, $status);
                            }
                            elseif( in_array($key, $activeTableColumns) )
                            {
                                $this->modifyColumnFromActiveTable($table, $key, $val, $dbForge, $status, $activeTableKey, $currentTableKey);
                            }
                            else
                            {
                                $this->addColumnFromActiveTable($table, $key, $val, $dbForge, $status);
                            }
                        }

                        if( $status === true )
                        {
                            $this->addTableToArchive($database, $table);
                        }
                    }
                    else
                    {
                        $activeTableColumnSchema[$currentTableKey] = $tableKeyColumnDesignData;

                        $dbForge->createTable($table, $activeTableColumnSchema);
                    }
                }
            }
        }
    }
protected function active ( ) { if ( empty ( $ activeDatabaseList = $ this -> getActiveDatabaseList ( ) ) ) { return false ; } $ this -> setActiveDatabaseEncoding ( $ encoding ) ; $ status = false ; $ tableKeyColumnDesignData = $ this -> getTableKeyColumnDesignData ( ) ; foreach ( $ activeDatabaseList as $ database ) { $ this -> forge -> createDatabase ( $ database , $ encoding ) ; if ( ! empty ( $ activeTableList = $ this -> getTableListByActiveDatabase ( $ database ) ) ) { $ dbForge = $ this -> getDBForgeDifferentConnectionByDatabaseName ( $ database ) ; $ db = $ this -> getDBDifferentConnectionByDatabaseName ( $ database ) ; foreach ( $ activeTableList as $ table ) { $ activeTableColumnSchema = $ this -> getActiveTableColumnSchema ( $ database , $ table ) ; $ this -> addIdColumnToActiveTableIfNotExists ( $ activeTableColumnSchema ) ; $ activeTableColumns = $ this -> getActiveTableColumns ( $ table = $ this -> getTableNameWithoutExtension ( $ table ) , $ db ) ; $ this -> getActiveTableKeyAndColumns ( $ activeTableColumns , $ activeTableKey , $ activeTableColumns ) ; $ currentTableKey = $ this -> getCurrentTableKey ( $ table , $ activeTableColumnSchema ) ; if ( ! empty ( $ activeTableColumns ) ) { $ columnsMerge = array_merge ( array_flip ( $ activeTableColumns ) , $ activeTableColumnSchema ) ; foreach ( $ columnsMerge as $ key => $ val ) { if ( is_numeric ( $ val ) ) { $ this -> dropColumnFromActiveTable ( $ table , $ key , $ dbForge , $ status ) ; } elseif ( in_array ( $ key , $ activeTableColumns ) ) { $ this -> modifyColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , $ status , $ activeTableKey , $ currentTableKey ) ; } else { $ this -> addColumnFromActiveTable ( $ table , $ key , $ val , $ dbForge , $ status ) ; } } if ( $ status === true ) { $ this -> addTableToArchive ( $ database , $ table ) ; } } else { $ activeTableColumnSchema [ $ currentTableKey ] = $ tableKeyColumnDesignData ; $ dbForge -> createTable ( $ table , $ activeTableColumnSchema ) ; } } } } }
Protected Actives Databases
Protected Actives Databases