38 lines
		
	
	
		
			941 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			941 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| 
 | |
| use yii\db\Migration;
 | |
| 
 | |
| /**
 | |
|  * Handles the creation of table `project`.
 | |
|  */
 | |
| class m181008_090446_create_project_table extends Migration
 | |
| {
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     public function safeUp()
 | |
|     {
 | |
|         $tableOptions = null;
 | |
|         if ($this->db->driverName === 'mysql') {
 | |
|             // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
 | |
|             $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
 | |
|         }
 | |
| 
 | |
|         $this->createTable('project', [
 | |
|             'id' => $this->primaryKey(),
 | |
|             'name' => $this->string(255)->notNull(),
 | |
|             'description' => $this->text(),
 | |
|             'created_at' => $this->dateTime(),
 | |
|             'updated_at' => $this->dateTime(),
 | |
|         ], $tableOptions);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * {@inheritdoc}
 | |
|      */
 | |
|     public function safeDown()
 | |
|     {
 | |
|         $this->dropTable('project');
 | |
|     }
 | |
| }
 | 
