Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMigration overwrite `Illuminate\Database\Migrations\Migration` $connection property but Do not work #25350
Comments
This comment has been minimized.
This comment has been minimized.
Please post your migration. |
This comment has been minimized.
This comment has been minimized.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDiseaseTable extends Migration
{
protected $connection = 'PhysicalExamItem';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('disease', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 32)->default('')->comment('疾病名称');
$table->integer('type_id')->comment('疾病类别id');
$table->text('intro')->default('')->comment('简介');
$table->text('cause_or_hazard_factor')->default('')->comment('病因或危害因素');
$table->text('clinical_manifestation')->default('')->comment('临床表现');
$table->text('advice')->default('')->comment('建议');
$table->text('remark')->default('')->comment('备注');
$table->text('prognosis')->default('')->comment('预后');
$table->boolean('is_enable')->default(true)->comment('是否启用');
$table->string('operator', 32)->comment('最后修改人');
$table->integer('display_order')->default(0)->comment('显示顺序');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('disease');
}
} |
This comment has been minimized.
This comment has been minimized.
in databases config 'PhysicalExamItem' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'peis_user'),
'username' => env('DB_USERNAME', 'codercat'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'oauth',
'sslmode' => 'prefer',
], |
This comment has been minimized.
This comment has been minimized.
I hope migrate to PhysicalExamItem |
This comment has been minimized.
This comment has been minimized.
I don't want to use Schema::connection('PhysicalExamItem') |
This comment has been minimized.
This comment has been minimized.
Judging from the description of But after looking at the implementation, I'm not sure this is possible to fix. AFAICS, |
This comment has been minimized.
This comment has been minimized.
@acodercat You can change the schema connection by using Ah sorry, I just saw that you don't wanna use that. Why not? |
This comment has been minimized.
This comment has been minimized.
I'm not sure what else can be done. If you dont want to use the support functions there's not much else we can do? |
laurencei
closed this
Sep 18, 2018
This comment has been minimized.
This comment has been minimized.
@laurencei I want overwrite Illuminate\Database\Migrations\Migration $connection property |
acodercat commentedAug 27, 2018
•
edited
Description:
Migration overwrite
Illuminate\Database\Migrations\Migration
$connection property but Do not work,migrated to the default database.Steps To Reproduce:
php artisan migrate