チェックインデータがCSVで投入されたことを記録できるようにした
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddSourceToEjaculations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ejaculation_sources', function (Blueprint $table) {
|
||||
$table->string('name');
|
||||
$table->primary('name');
|
||||
});
|
||||
Schema::table('ejaculations', function (Blueprint $table) {
|
||||
$table->string('source')->nullable();
|
||||
$table->foreign('source')->references('name')->on('ejaculation_sources');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ejaculations', function (Blueprint $table) {
|
||||
$table->dropColumn('source');
|
||||
});
|
||||
Schema::drop('ejaculation_sources');
|
||||
}
|
||||
}
|
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
$this->call(EjaculationSourcesSeeder::class);
|
||||
}
|
||||
}
|
||||
|
19
database/seeds/EjaculationSourcesSeeder.php
Normal file
19
database/seeds/EjaculationSourcesSeeder.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EjaculationSourcesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$sources = ['web', 'csv'];
|
||||
foreach ($sources as $source) {
|
||||
DB::table('ejaculation_sources')->insert(['name' => $source]);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user