Showing
3 changed files
with
20 additions
and
3 deletions
| ... | @@ -12,7 +12,13 @@ class CreateBooksTable extends Migration | ... | @@ -12,7 +12,13 @@ class CreateBooksTable extends Migration |
| 12 | */ | 12 | */ |
| 13 | public function up() | 13 | public function up() |
| 14 | { | 14 | { |
| 15 | - Schema::create('books', function (Blueprint $table) { | 15 | + $pdo = \DB::connection()->getPdo(); |
| 16 | + $mysqlVersion = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION); | ||
| 17 | + $requiresISAM = strpos($mysqlVersion, '5.5') === 0; | ||
| 18 | + | ||
| 19 | + Schema::create('books', function (Blueprint $table) use ($requiresISAM) { | ||
| 20 | + if($requiresISAM) $table->engine = 'MyISAM'; | ||
| 21 | + | ||
| 16 | $table->increments('id'); | 22 | $table->increments('id'); |
| 17 | $table->string('name'); | 23 | $table->string('name'); |
| 18 | $table->string('slug')->indexed(); | 24 | $table->string('slug')->indexed(); | ... | ... |
| ... | @@ -12,7 +12,13 @@ class CreatePagesTable extends Migration | ... | @@ -12,7 +12,13 @@ class CreatePagesTable extends Migration |
| 12 | */ | 12 | */ |
| 13 | public function up() | 13 | public function up() |
| 14 | { | 14 | { |
| 15 | - Schema::create('pages', function (Blueprint $table) { | 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 | + | ||
| 16 | $table->increments('id'); | 22 | $table->increments('id'); |
| 17 | $table->integer('book_id'); | 23 | $table->integer('book_id'); |
| 18 | $table->integer('chapter_id'); | 24 | $table->integer('chapter_id'); | ... | ... |
| ... | @@ -12,7 +12,12 @@ class CreateChaptersTable extends Migration | ... | @@ -12,7 +12,12 @@ class CreateChaptersTable extends Migration |
| 12 | */ | 12 | */ |
| 13 | public function up() | 13 | public function up() |
| 14 | { | 14 | { |
| 15 | - Schema::create('chapters', function (Blueprint $table) { | 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'; | ||
| 16 | $table->increments('id'); | 21 | $table->increments('id'); |
| 17 | $table->integer('book_id'); | 22 | $table->integer('book_id'); |
| 18 | $table->string('slug')->indexed(); | 23 | $table->string('slug')->indexed(); | ... | ... |
-
Please register or sign in to post a comment