Add incident column for when an incident occurred at (#2212)

Add incident column for when an incident occurred at. Closes #2208
[ci skip] [skip ci]
This commit is contained in:
James Brooks
2016-10-29 17:25:52 +01:00
committed by GitHub
parent 0e0a7d9db2
commit a0f2d6642e
26 changed files with 331 additions and 79 deletions

View File

@@ -0,0 +1,45 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class AlterTableIncidentsAddOccurredAtColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
$table->timestamp('occurred_at')->nullable()->after('scheduled_at');
});
// We need a better way of handling data migrations...
DB::update('UPDATE incidents SET `occurred_at` = `created_at`');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
$table->dropColumn('occurred_at');
});
}
}