adrema/database/migrations/2018_01_16_012910_create_ac...

52 lines
1.6 KiB
PHP
Raw Permalink Normal View History

2020-04-10 20:32:12 +02:00
<?php
2020-04-12 00:26:44 +02:00
use Illuminate\Database\Migrations\Migration;
2022-02-12 01:06:44 +01:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
2020-04-10 20:32:12 +02:00
2020-04-12 00:26:44 +02:00
class CreateActivitiesTable extends Migration
2020-04-10 20:32:12 +02:00
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
2020-04-12 00:26:44 +02:00
Schema::create('activities', function (Blueprint $table) {
2021-04-10 02:57:10 +02:00
$table->id();
2020-04-12 00:26:44 +02:00
$table->string('name');
2022-02-12 01:06:44 +01:00
$table->string('slug');
$table->boolean('is_filterable')->default(false);
$table->boolean('is_member')->default(false);
$table->boolean('is_try')->default(false);
$table->unsignedInteger('nami_id');
});
Schema::create('subactivities', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug');
$table->boolean('is_age_group')->default(false);
$table->boolean('is_filterable')->default(false);
$table->unsignedInteger('nami_id')->nullable();
});
Schema::create('activity_subactivity', function (Blueprint $table) {
$table->foreignId('activity_id')->constrained();
$table->foreignId('subactivity_id')->constrained();
$table->unique(['activity_id', 'subactivity_id']);
2020-04-10 20:32:12 +02:00
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2023-06-29 12:57:06 +02:00
Schema::dropIfExists('activity_subactivity');
Schema::dropIfExists('subactivities');
2020-04-12 00:26:44 +02:00
Schema::dropIfExists('activities');
2020-04-10 20:32:12 +02:00
}
}