Some checks failed
continuous-integration/drone/push Build is failing
- Complete GGZ Ecademy Laravel backend application - RESTful API for learning products, members, filters - Authentication and authorization system - Database migrations and seeders - Custom CRUD generator commands - Email notification system - Integration with frontend applications
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateSummariesTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('summaries', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->unsignedInteger('member_id');
|
|
$table->integer('year');
|
|
$table->integer('real_number_last_year')->nullable();
|
|
$table->integer('estimated_number_next_year')->nullable();
|
|
$table->unique(['member_id', 'year']);
|
|
$table->timestamps();
|
|
});
|
|
|
|
Schema::table('summaries', function (Blueprint $table) {
|
|
$table->foreign('member_id')->references('id')->on('members')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::table('summaries', function (Blueprint $table) {
|
|
$table->dropForeign('summaries_member_id_foreign');
|
|
});
|
|
|
|
Schema::dropIfExists('summaries');
|
|
}
|
|
}
|