Specify connection in a laravel migration
我正在为Laravel 6项目创建迁移。它具有多个数据库连接以确保数据安全。
我正在尝试使用laravel迁移来控制数据库和种子。为了使模型更清晰,我建立了两个在
中定义的数据库
1 2 3 4 5 6 7 | 'connections' => [ 'core' => [ ... ], 'regional' => [ ... ] ] |
然后使用
在开始进行迁移时,基本的laravel
1 2 3 4 5 6 7 8 9 10 11 12 | public function up() { Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } |
如何指定此数据库使用的连接?
预先感谢。
尝试
在此处查看更多信息:https://laravel.com/docs/6.x/migrations