adrema/database/migrations/2022_01_18_205354_create_me...

40 lines
1.0 KiB
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
use Illuminate\Database\Migrations\Migration;
2022-01-03 10:33:48 +01:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
2020-04-12 00:26:44 +02:00
class CreateMembershipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('memberships', function (Blueprint $table) {
2021-04-10 02:57:10 +02:00
$table->id();
2022-02-12 01:06:44 +01:00
$table->foreignId('group_id')->constrained();
$table->foreignId('member_id')->constrained();
$table->unsignedInteger('nami_id')->nullable();
2022-01-03 10:33:48 +01:00
$table->datetime('from');
2020-04-12 00:26:44 +02:00
$table->timestamps();
2022-02-12 01:06:44 +01:00
$table->foreignId('activity_id')->constrained();
$table->foreignId('subactivity_id')->nullable()->constrained();
$table->unique(['activity_id', 'subactivity_id', 'group_id', 'member_id', 'nami_id'], 'memberships_unique');
2020-04-12 00:26:44 +02:00
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('memberships');
}
}