ejaculations.sourceはNULL非許容にする
This commit is contained in:
parent
00f75f33cc
commit
e2f01561a8
@ -17,7 +17,7 @@ class Ejaculation extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id', 'ejaculated_date',
|
'user_id', 'ejaculated_date',
|
||||||
'note', 'geo_latitude', 'geo_longitude', 'link',
|
'note', 'geo_latitude', 'geo_longitude', 'link', 'source',
|
||||||
'is_private', 'is_too_sensitive'
|
'is_private', 'is_too_sensitive'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ class EjaculationController extends Controller
|
|||||||
'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']),
|
'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']),
|
||||||
'note' => $inputs['note'] ?? '',
|
'note' => $inputs['note'] ?? '',
|
||||||
'link' => $inputs['link'] ?? '',
|
'link' => $inputs['link'] ?? '',
|
||||||
|
'source' => Ejaculation::SOURCE_WEB,
|
||||||
'is_private' => $request->has('is_private') ?? false,
|
'is_private' => $request->has('is_private') ?? false,
|
||||||
'is_too_sensitive' => $request->has('is_too_sensitive') ?? false
|
'is_too_sensitive' => $request->has('is_too_sensitive') ?? false
|
||||||
]);
|
]);
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Ejaculation;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class MakeNonNullableSourceOnEjaculations extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
DB::statement('UPDATE ejaculations SET source = ? WHERE source IS NULL', [Ejaculation::SOURCE_WEB]);
|
||||||
|
Schema::table('ejaculations', function (Blueprint $table) {
|
||||||
|
$table->string('source')->nullable(false)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('ejaculations', function (Blueprint $table) {
|
||||||
|
$table->string('source')->nullable()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user