Skip to content

Commit

Permalink
[UPDATE] add alter method
Browse files Browse the repository at this point in the history
  • Loading branch information
simon committed Dec 26, 2022
1 parent e48b372 commit 02196a8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Migration/Schematics.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@
namespace Larangular\MigrationPackage\Migration;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

trait Schematics {

public function create(\Closure $callback): void {
Schema::connection($this->connection)
->create($this->name, function(Blueprint $table) use ($callback)
{
$callback($table);
});
->create($this->name, function (Blueprint $table) use ($callback) {
$callback($table);
});
}

public function alter(\Closure $callback): void {
Schema::connection($this->connection)
->table($this->name, function (Blueprint $table) use ($callback) {
$callback($table);
});
}

public function drop(): void {
Schema::connection($this->connection)->drop($this->name);
Schema::connection($this->connection)
->drop($this->name);
}

public function jsonableColumnType(): string {
Expand Down

0 comments on commit 02196a8

Please sign in to comment.