protected function getDownStub()
    {
        switch($this->action) {
          case 'add':
          case 'insert':
            // then we to remove columns in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down.txt');
            $fields = $this->fields ? $this->setFields('dropColumn') : '';
            break;

          case 'remove':
          case 'drop':
          case 'delete':
            // then we need to add the columns in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down.txt');
            $fields = $this->fields ? $this->setFields('addColumn') : '';
            break;

          case 'destroy':
            // then we need to create the table in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down-create.txt');
            $fields = $this->fields ? $this->setFields('addColumn') : '';
            break;

          case 'create':
          case 'make':
          default:
            // then we need to drop the table in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down-drop.txt');
            $fields = $this->fields ? $this->setFields('dropColumn') : '';
            break;
        }

        // Replace the tableName in the template
        $downMethod = str_replace('{{tableName}}', $this->tableName, $downMethod);

        // Insert the schema into the down method
        return str_replace('{{methods}}', $fields, $downMethod);
    }
protected function getDownStub()
    {
        switch($this->action) {
          case 'add':
          case 'insert':
            // then we to remove columns in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down.txt');
            $fields = $this->fields ? $this->setFields('dropColumn') : '';
            break;

          case 'remove':
          case 'drop':
          case 'delete':
            // then we need to add the columns in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down.txt');
            $fields = $this->fields ? $this->setFields('addColumn') : '';
            break;

          case 'destroy':
            // then we need to create the table in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down-create.txt');
            $fields = $this->fields ? $this->setFields('addColumn') : '';
            break;

          case 'create':
          case 'make':
          default:
            // then we need to drop the table in reverse
            $downMethod = $this->file->get(__DIR__ . '/templates/migration/migration-down-drop.txt');
            $fields = $this->fields ? $this->setFields('dropColumn') : '';
            break;
        }

        // Replace the tableName in the template
        $downMethod = str_replace('{{tableName}}', $this->tableName, $downMethod);

        // Insert the schema into the down method
        return str_replace('{{methods}}', $fields, $downMethod);
    }
protected function getDownStub ( ) { switch ( $ this -> action ) { case 'add' : case 'insert' : // then we to remove columns in reverse $ downMethod = $ this -> file -> get ( __DIR__ . '/templates/migration/migration-down.txt' ) ; $ fields = $ this -> fields ? $ this -> setFields ( 'dropColumn' ) : '' ; break ; case 'remove' : case 'drop' : case 'delete' : // then we need to add the columns in reverse $ downMethod = $ this -> file -> get ( __DIR__ . '/templates/migration/migration-down.txt' ) ; $ fields = $ this -> fields ? $ this -> setFields ( 'addColumn' ) : '' ; break ; case 'destroy' : // then we need to create the table in reverse $ downMethod = $ this -> file -> get ( __DIR__ . '/templates/migration/migration-down-create.txt' ) ; $ fields = $ this -> fields ? $ this -> setFields ( 'addColumn' ) : '' ; break ; case 'create' : case 'make' : default : // then we need to drop the table in reverse $ downMethod = $ this -> file -> get ( __DIR__ . '/templates/migration/migration-down-drop.txt' ) ; $ fields = $ this -> fields ? $ this -> setFields ( 'dropColumn' ) : '' ; break ; } // Replace the tableName in the template $ downMethod = str_replace ( '{{tableName}}' , $ this -> tableName , $ downMethod ) ; // Insert the schema into the down method return str_replace ( '{{methods}}' , $ fields , $ downMethod ) ; }
Grab down method stub and replace template vars

@return string
Grab down method stub and replace template vars