Create metric migrations and models
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMetricsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('metrics', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable(false);
|
||||
$table->string('suffix')->nullable(false);
|
||||
$table->string('description')->nullable(false);
|
||||
$table->boolean('display_chart')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('metrics');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMetricPointsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('metric_points', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('metric_id')->unsigned();
|
||||
$table->integer('value')->unsigned();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('metric_id')->references('id')->on('metrics');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('metric_points');
|
||||
}
|
||||
|
||||
}
|
||||
5
app/models/Metric.php
Normal file
5
app/models/Metric.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Metric extends Eloquent {
|
||||
|
||||
}
|
||||
5
app/models/MetricPoint.php
Normal file
5
app/models/MetricPoint.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class MetricPoint extends Eloquent {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user