| 
									
										
										
										
											2015-07-13 03:01:42 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Database\Schema\Blueprint; | 
					
						
							|  |  |  | use Illuminate\Database\Migrations\Migration; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CreatePagesTable extends Migration | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Run the migrations. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function up() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-06-04 23:32:57 +08:00
										 |  |  |         $pdo = \DB::connection()->getPdo(); | 
					
						
							|  |  |  |         $mysqlVersion = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION); | 
					
						
							|  |  |  |         $requiresISAM = strpos($mysqlVersion, '5.5') === 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Schema::create('pages', function (Blueprint $table) use ($requiresISAM) { | 
					
						
							|  |  |  |             if($requiresISAM) $table->engine = 'MyISAM'; | 
					
						
							|  |  |  |              | 
					
						
							| 
									
										
										
										
											2015-07-13 03:01:42 +08:00
										 |  |  |             $table->increments('id'); | 
					
						
							| 
									
										
										
										
											2015-07-13 04:31:15 +08:00
										 |  |  |             $table->integer('book_id'); | 
					
						
							| 
									
										
										
										
											2015-07-28 03:17:08 +08:00
										 |  |  |             $table->integer('chapter_id'); | 
					
						
							| 
									
										
										
										
											2015-07-13 04:31:15 +08:00
										 |  |  |             $table->string('name'); | 
					
						
							|  |  |  |             $table->string('slug')->indexed(); | 
					
						
							|  |  |  |             $table->longText('html'); | 
					
						
							|  |  |  |             $table->longText('text'); | 
					
						
							|  |  |  |             $table->integer('priority'); | 
					
						
							| 
									
										
										
										
											2016-02-17 05:25:11 +08:00
										 |  |  |             $table->nullableTimestamps(); | 
					
						
							| 
									
										
										
										
											2015-07-13 03:01:42 +08:00
										 |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Reverse the migrations. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function down() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Schema::drop('pages'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |