私は、次の移行複数のデータベース
public function handle()
{
$sites = Sites::all();
foreach($sites as $site)
{
$host = $site->h;
$database = $site->d;
$username = $site->u;
$password = $site->p;
$this->info('Trying to migrate ' . $database);
Config::set('database.connections.mysql.host', $host);
Config::set('database.connections.mysql.database', $database);
Config::set('database.connections.mysql.username', $username);
Config::set('database.connections.mysql.password', $password);
//Reconnect with new credentials
DB::reconnect('mysql');
//Call the migration on the new connection
$this->call('migrate');
$this->info('Migrations complete for database ' . $site->d);
}
}
最初のサイトは常に、それはすでに、1そこにいるにもかかわらず、移行テーブルを作成しようとし続けるしかし後に、細かな移行が含まれている私のコマンドmigrate:s
を持っていますデータが入力されます。
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migrations' already exists
資格情報がデータベースの正しいです、私は最初の移行後にテーブルを作成しようとしているなぜを把握することはできません。
各サイトの移行テーブルの内容を確認してください。私は同期が外れているので、移行テーブルを作成するために移行を実行していないと思っていますか?また、Laravelのどのバージョンをお使いですか? – Loren
@Loren 5.1では、移行テーブルがいっぱいです。データベースを削除しました。クリーンインストールからは、常に最初に動作します。ちょうど今遊んで、何らかの理由で資格情報を同期していないようです。 – Ian