Is there a way to migrate, migrations with something before the tablename?
For example I got the tables named roles and users. I want it to migrate to db_roles and db_users. Is there a way to do this?
Is there a way to migrate, migrations with something before the tablename?
For example I got the tables named roles and users. I want it to migrate to db_roles and db_users. Is there a way to do this?
So in the Laravel codebase, you can see that the Illuminate\Database\Schema\Blueprint
class accepts a database prefix as it's final arguement. This does allow you to add a prefix to the table name.
/**
* Create a new schema blueprint.
*
* @param string $table
* @param \Closure|null $callback
* @param string $prefix
* @return void
*/
public function __construct($table, Closure $callback = null, $prefix = '')
{
$this->table = $table;
$this->prefix = $prefix;
if (! is_null($callback)) {
$callback($this);
}
}
I have not implemented this practically, but theoretically this how you could do it.