]> BookStack Code Mirror - bookstack/blob - database/migrations/2015_07_27_172342_create_chapters_table.php
Resolves book heading issues in grid view.
[bookstack] / database / migrations / 2015_07_27_172342_create_chapters_table.php
1 <?php
2
3 use Illuminate\Database\Schema\Blueprint;
4 use Illuminate\Database\Migrations\Migration;
5
6 class CreateChaptersTable extends Migration
7 {
8     /**
9      * Run the migrations.
10      *
11      * @return void
12      */
13     public function up()
14     {
15         $pdo = \DB::connection()->getPdo();
16         $mysqlVersion = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION);
17         $requiresISAM = strpos($mysqlVersion, '5.5') === 0;
18
19         Schema::create('chapters', function (Blueprint $table) use ($requiresISAM) {
20             if($requiresISAM) $table->engine = 'MyISAM';
21             $table->increments('id');
22             $table->integer('book_id');
23             $table->string('slug')->indexed();
24             $table->text('name');
25             $table->text('description');
26             $table->integer('priority');
27             $table->nullableTimestamps();
28         });
29     }
30
31     /**
32      * Reverse the migrations.
33      *
34      * @return void
35      */
36     public function down()
37     {
38         Schema::drop('chapters');
39     }
40 }