|
|
|
@ -2,7 +2,9 @@
|
|
|
|
|
|
|
|
|
|
namespace Engelsystem\Migrations;
|
|
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
use Engelsystem\Database\Migration\Migration;
|
|
|
|
|
use Engelsystem\Models\Question;
|
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
|
|
|
|
|
class AddTimestampsToQuestions extends Migration
|
|
|
|
@ -18,6 +20,17 @@ class AddTimestampsToQuestions extends Migration
|
|
|
|
|
$table->timestamp('answered_at')->after('answerer_id')->nullable();
|
|
|
|
|
$table->timestamps();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$now = Carbon::now();
|
|
|
|
|
Question::query()->update([
|
|
|
|
|
'created_at' => $now,
|
|
|
|
|
'updated_at' => $now,
|
|
|
|
|
]);
|
|
|
|
|
Question::query()
|
|
|
|
|
->whereNotNull('answerer_id')
|
|
|
|
|
->update([
|
|
|
|
|
'answered_at' => $now,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|