]> git.localhorst.tv Git - alttp.git/blob - database/migrations/2022_08_21_130547_create_technique_chapter_table.php
technique chapters
[alttp.git] / database / migrations / 2022_08_21_130547_create_technique_chapter_table.php
1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9         /**
10          * Run the migrations.
11          *
12          * @return void
13          */
14         public function up()
15         {
16                 Schema::table('techniques', function (Blueprint $table) {
17                         $table->string('name')->nullable()->default(null)->change();
18                 });
19                 Schema::create('technique_chapter', function (Blueprint $table) {
20                         $table->id();
21                         $table->foreignId('parent_id')->references('id')->on('techniques')->constrained();
22                         $table->foreignId('child_id')->references('id')->on('techniques')->constrained();
23                         $table->integer('level')->default(2);
24                         $table->integer('order')->default(0);
25                         $table->timestamps();
26                 });
27         }
28
29         /**
30          * Reverse the migrations.
31          *
32          * @return void
33          */
34         public function down()
35         {
36                 Schema::dropIfExists('technique_chapter');
37         }
38 };