|
2 | 2 |
|
3 | 3 | use Illuminate\Database\Migrations\Migration; |
4 | 4 | use Illuminate\Database\Schema\Blueprint; |
| 5 | +use Illuminate\Support\Facades\DB; |
5 | 6 | use Illuminate\Support\Facades\Schema; |
6 | 7 |
|
7 | 8 | class CreateXHProfTable extends Migration |
8 | 9 | { |
9 | | - /** |
10 | | - * Run the migrations. |
11 | | - * |
12 | | - * @return void |
13 | | - */ |
14 | | - public function up() |
15 | | - { |
16 | | - Schema::create('details', function (Blueprint $table) { |
17 | | - $table->id('idcount'); |
18 | | - $table->char('id', 64); |
19 | | - $table->char('url', 255)->nullable(); |
20 | | - $table->char('c_url', 255)->nullable(); |
21 | | - $table->timestamp('timestamp')->useCurrent()->useCurrentOnUpdate(); |
22 | | - $table->char('server name', 64)->nullable(); |
23 | | - $table->binary('perfdata')->nullable(); |
24 | | - $table->tinyInteger('type')->nullable(); |
25 | | - $table->binary('cookie')->nullable(); |
26 | | - $table->binary('post')->nullable(); |
27 | | - $table->binary('get')->nullable(); |
28 | | - $table->integer('pmu')->nullable(); |
29 | | - $table->integer('wt')->nullable(); |
30 | | - $table->integer('cpu')->nullable(); |
31 | | - $table->char('server_id', 64)->nullable(); |
32 | | - $table->char('aggregateCalls_include', 255)->nullable(); |
| 10 | + /** |
| 11 | + * Run the migrations. |
| 12 | + * |
| 13 | + * @return void |
| 14 | + */ |
| 15 | + public function up() |
| 16 | + { |
| 17 | + Schema::create('details', function (Blueprint $table) { |
| 18 | + $table->id('idcount'); |
| 19 | + $table->char('id', 64); |
| 20 | + $table->char('url', 255)->nullable(); |
| 21 | + $table->char('c_url', 255)->nullable(); |
| 22 | + $table->timestamp('timestamp')->useCurrent()->useCurrentOnUpdate(); |
| 23 | + $table->char('server name', 64)->nullable(); |
| 24 | + $table->binary('perfdata')->nullable(); |
| 25 | + $table->tinyInteger('type')->nullable(); |
| 26 | + $table->binary('cookie')->nullable(); |
| 27 | + $table->binary('post')->nullable(); |
| 28 | + $table->binary('get')->nullable(); |
| 29 | + $table->integer('pmu')->nullable(); |
| 30 | + $table->integer('wt')->nullable(); |
| 31 | + $table->integer('cpu')->nullable(); |
| 32 | + $table->char('server_id', 64)->nullable(); |
| 33 | + $table->char('aggregateCalls_include', 255)->nullable(); |
33 | 34 |
|
34 | | - $table->index('url'); |
35 | | - $table->index('c_url'); |
36 | | - $table->index('cpu'); |
37 | | - $table->index('wt'); |
38 | | - $table->index('pmu'); |
39 | | - $table->index('timestamp'); |
40 | | - $table->index(['server name', 'timestamp']); |
41 | | - }); |
42 | | - |
43 | | - if(DB::connection()->getDriverName() === 'mysql') { |
44 | | - DB::statement('ALTER TABLE details MODIFY COLUMN `perfdata` LONGBLOB'); |
45 | | - DB::statement('ALTER TABLE details MODIFY COLUMN `cookie` LONGBLOB'); |
46 | | - DB::statement('ALTER TABLE details MODIFY COLUMN `post` LONGBLOB'); |
47 | | - } |
48 | | - } |
| 35 | + $table->index('url'); |
| 36 | + $table->index('c_url'); |
| 37 | + $table->index('cpu'); |
| 38 | + $table->index('wt'); |
| 39 | + $table->index('pmu'); |
| 40 | + $table->index('timestamp'); |
| 41 | + $table->index(['server name', 'timestamp']); |
| 42 | + }); |
49 | 43 |
|
50 | | - /** |
51 | | - * Reverse the migrations. |
52 | | - * |
53 | | - * @return void |
54 | | - */ |
55 | | - public function down() |
56 | | - { |
57 | | - Schema::dropIfExists('details'); |
58 | | - } |
59 | | -}; |
| 44 | + if (DB::connection()->getDriverName() === 'mysql') { |
| 45 | + DB::statement('ALTER TABLE details MODIFY COLUMN `perfdata` LONGBLOB'); |
| 46 | + DB::statement('ALTER TABLE details MODIFY COLUMN `cookie` LONGBLOB'); |
| 47 | + DB::statement('ALTER TABLE details MODIFY COLUMN `post` LONGBLOB'); |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * Reverse the migrations. |
| 53 | + * |
| 54 | + * @return void |
| 55 | + */ |
| 56 | + public function down() |
| 57 | + { |
| 58 | + Schema::dropIfExists('details'); |
| 59 | + } |
| 60 | +} |
0 commit comments