Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 588 forks source link

Table Prefix Error when use connection #133

Closed al-one closed 3 years ago

al-one commented 7 years ago

\Xethron\MigrationsGenerator\Syntax\Table::run

    public function run(array $fields, $table, $connection = null, $method = 'table')
    {
        $table = substr($table, strlen(\DB::connection($connection)->getTablePrefix()));
        $this->table = $table;
        if (!is_null($connection)) $method = 'connection(\''.$connection.'\')->'.$method;
        $compiled = $this->compiler->compile($this->getTemplate(), ['table'=>$table,'method'=>$method]);
        return $this->replaceFieldsWith($this->getItems($fields), $compiled);
    }