Advertisement
Guest User

Yii-DB Migrations 6.

a guest
Nov 19th, 2010
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. class m20090611153243_CreateTables extends CDbMigration {
  2.  
  3.     // Apply the migration
  4.     public function up() {
  5.  
  6.         // Create the posts table
  7.         $t = $this->newTable('posts');
  8.         $t->primary_key('id');
  9.         $t->string('title');
  10.         $t->text('body');
  11.         $t->index('posts_title', 'title');
  12.         $this->addTable($t);
  13.  
  14.     }
  15.  
  16.     // Remove the migration
  17.     public function down() {
  18.  
  19.         // Remove the table
  20.         $this->removeTable('posts');
  21.  
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement