]> BookStack Code Mirror - bookstack/blob - database/migrations/2015_07_12_190027_create_pages_table.php
Resolves book heading issues in grid view.
[bookstack] / database / migrations / 2015_07_12_190027_create_pages_table.php
1 <?php
2
3 use Illuminate\Database\Schema\Blueprint;
4 use Illuminate\Database\Migrations\Migration;
5
6 class CreatePagesTable 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('pages', function (Blueprint $table) use ($requiresISAM) {
20             if($requiresISAM) $table->engine = 'MyISAM';
21             
22             $table->increments('id');
23             $table->integer('book_id');
24             $table->integer('chapter_id');
25             $table->string('name');
26             $table->string('slug')->indexed();
27             $table->longText('html');
28             $table->longText('text');
29             $table->integer('priority');
30             $table->nullableTimestamps();
31         });
32     }
33
34     /**
35      * Reverse the migrations.
36      *
37      * @return void
38      */
39     public function down()
40     {
41         Schema::drop('pages');
42     }
43 }