INIT: initial commit

This commit is contained in:
Michal Kváček
2017-09-23 00:46:53 +02:00
commit ed32a1c27b
29 changed files with 935 additions and 0 deletions
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateQueriesLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('queries_log', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->text('query');
$table->text('bindings');
$table->double('time');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('queries_log');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateHttpLogTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('http_log', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->string('method');
$table->text('url');
$table->double('time');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('http_log');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateHttpLogAddLoadAvg extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('http_log', function (Blueprint $table) {
$table->double('load_1')->nullable();
$table->double('load_5')->nullable();
$table->double('load_15')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('http_log', function (Blueprint $table) {
$table->dropColumn('load_1');
$table->dropColumn('load_5');
$table->dropColumn('load_15');
});
}
}
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class UpdateQueryLogAddRequestId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('queries_log', function (Blueprint $table) {
$table->integer('http_log_id')
->nullable()
->unsigned()
->after('id')
->comment('FK to http_log');
$table->foreign('http_log_id')
->references('id')
->on('http_log')
->onDelete('cascade')
->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('queries_log', function (Blueprint $table) {
// $table->dropForeign('');
$table->dropColumn('http_log_id');
});
}
}
View File
@@ -0,0 +1,20 @@
<?php namespace Modules\Profiler\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class ProfilerDatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}