-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigration.php
More file actions
33 lines (26 loc) · 906 Bytes
/
Migration.php
File metadata and controls
33 lines (26 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Simple\Lumen\Utils;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration as Illuminate_Migration;
class Migration extends Illuminate_Migration {
/* RESET:
* php artisan migrate:refresh
* php artisan migrate:reset --force
*/
protected $table = "migrations";
protected $connection = 'mysql';
protected function col($tablename, $type, $column, $extra = null) {
if(!is_array($column)){
$column = [$column];
}
if (!Schema::hasColumn($tablename, $column[0])) {
Schema::table($tablename, function (Blueprint $table) use ($type, $column, $extra) {
$col = call_user_func_array([$table, $type], $column);
if($extra){
$col->$extra();
}
});
}
}
}