Skip to content

Commit c62d0a1

Browse files
author
Tim Helfensdörfer
committed
Use different database if necessary
1 parent d2a9828 commit c62d0a1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/migrations/2017_02_12_102845_create_logger_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CreateLoggerTable extends Migration
1313
*/
1414
public function up()
1515
{
16-
Schema::create(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
16+
Schema::connection(env('LOG_DATABASE', config('database.default')))->create(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
1717
$table->bigIncrements('id');
1818

1919
$table->text('message');
@@ -33,6 +33,6 @@ public function up()
3333
*/
3434
public function down()
3535
{
36-
Schema::dropIfExists(env('LOG_TABLE', 'logs'));
36+
Schema::connection(env('LOG_DATABASE', config('database.default')))->dropIfExists(env('LOG_TABLE', 'logs'));
3737
}
3838
}

src/migrations/2018_12_02_102846_update_text_columns.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UpdateTextColumns extends Migration
1313
*/
1414
public function up()
1515
{
16-
Schema::table(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
16+
Schema::connection(env('LOG_DATABASE', config('database.default')))->table(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
1717
$table->longText('message')->change();
1818
$table->longText('context')
1919
->nullable()
@@ -29,7 +29,7 @@ public function up()
2929
*/
3030
public function down()
3131
{
32-
Schema::table(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
32+
Schema::connection(env('LOG_DATABASE', config('database.default')))->table(env('LOG_TABLE', 'logs'), function (Blueprint $table) {
3333
$table->text('message')->change();
3434
$table->text('context')->change();
3535
$table->text('extra')->change();

0 commit comments

Comments
 (0)