forked from area17/twill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change activity log morph size to bigint.
- Loading branch information
1 parent
9535d82
commit be43d41
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
migrations/default/2022_04_05_000015_update_activity_log_morph_size.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class UpdateActivityLogMorphSize extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$connection = Schema::connection(config('activitylog.database_connection')); | ||
$tableName = config('activitylog.table_name'); | ||
|
||
if ($connection->hasTable($tableName)) { | ||
$connection->table( | ||
$tableName, | ||
function (Blueprint $table) use ($connection, $tableName) { | ||
if ($connection->hasColumn($tableName, 'subject_id')) { | ||
$table->bigInteger('subject_id')->change(); | ||
} | ||
|
||
if ($connection->hasColumn($tableName, 'causer_id')) { | ||
$table->bigInteger('causer_id')->change(); | ||
} | ||
} | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$connection = Schema::connection(config('activitylog.database_connection')); | ||
$tableName = config('activitylog.table_name'); | ||
|
||
if ($connection->hasTable($tableName)) { | ||
$connection->table( | ||
$tableName, | ||
function (Blueprint $table) use ($connection, $tableName) { | ||
if ($connection->hasColumn($tableName, 'subject_id')) { | ||
$table->integer('subject_id')->change(); | ||
} | ||
|
||
if ($connection->hasColumn($tableName, 'causer_id')) { | ||
$table->integer('causer_id')->change(); | ||
} | ||
} | ||
); | ||
} | ||
} | ||
} |