Created
October 8, 2015 13:55
-
-
Save lucassmacedo/5d4a4608bd751f299146 to your computer and use it in GitHub Desktop.
Migrations tutorial step 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phinx\Migration\AbstractMigration; | |
class CreatePostsTable extends AbstractMigration { | |
public function up() { | |
$table = $this->table('posts'); | |
$table->addColumn('title', 'string') | |
->addColumn('slug','string') | |
->addIndex(array('slug'), array('unique' => true)) | |
->addColumn('description', 'text') | |
->addColumn('created', 'datetime') | |
->create(); | |
} | |
public function down() { | |
$this->dropTable('posts'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment