Forked from JustLikeIcarus/2_tickets_comments_statuses_labels.php
Created
May 5, 2010 16:33
-
-
Save zeelot/391063 to your computer and use it in GitHub Desktop.
Sample Doctrine Migration
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 defined('SYSPATH') or die('No direct script access.'); | |
class TicketsCommentsStatusesLabels extends Doctrine_Migration_Base | |
{ | |
public function up() | |
{ | |
// Types | |
$int = array('type' => 'integer', 'length' => 8); | |
$varchar = array('type' => 'varchar', 'length' => 255); | |
$text = array('type' => 'text'); | |
// Attributes | |
$notnull = array('notnull' => TRUE); | |
$unsigned = array('unsigned' => TRUE); | |
$pk = array('primary' => TRUE); | |
$ai = array('autoincrement' => TRUE); | |
$this->createTable('tickets', array | |
( | |
'id' => $int + $notnull + $unsigned + $ai + $pk, | |
'user_id' => $int + $notnull + $unsigned, | |
'project_id' => $int + $notnull + $unsigned, | |
'status_id' => $int + $notnull + $unsigned, | |
'title' => $varchar, | |
'description' => $text, | |
'created_on' => $int + $notnull + $unsigned, | |
'last_update' => $int + $notnull + $unsigned, | |
), | |
array | |
( | |
'type' => 'INNODB', | |
'charset' => 'utf8' | |
)); | |
$this->createTable('comments', array | |
( | |
'id' => $int + $notnull + $unsigned + $ai + $pk, | |
'ticket_id' => $int + $notnull + $unsigned, | |
'user_id' => $int + $notnull + $unsigned, | |
'content' => $text, | |
'created_on' => $int + $notnull + $unsigned, | |
'last_update' => $int + $notnull + $unsigned, | |
), | |
array | |
( | |
'type' => 'INNODB', | |
'charset' => 'utf8' | |
)); | |
$this->createTable('statuses', array | |
( | |
'id' => $int + $notnull + $unsigned + $ai + $pk, | |
'name' => array('length' => 50) + $varchar, | |
), | |
array | |
( | |
'type' => 'INNODB', | |
'charset' => 'utf8' | |
)); | |
$this->createTable('labels', array( | |
'id' => $int + $notnull + $unsigned + $ai + $pk, | |
'name' => array('length' => 50) + $varchar, | |
'color' => array('length' => 6) + $varchar, | |
), | |
array | |
( | |
'type' => 'INNODB', | |
'charset' => 'utf8' | |
)); | |
$this->createTable('tickets_labels', array | |
( | |
'ticket_id' => $int + $notnull + $unsigned, | |
'label_id' => $int + $notnull + $unsigned, | |
), | |
array | |
( | |
'type' => 'INNODB', | |
'charset' => 'utf8' | |
)); | |
} | |
public function down() | |
{ | |
$this->dropTable('tickets'); | |
$this->dropTable('statuses'); | |
$this->dropTable('comments'); | |
$this->dropTable('labels'); | |
$this->dropTable('tickets_labels'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment