2014-09-04 97 views
0

有人能告诉我一个关于如何在Doctrine中使用createTable的例子吗? 例如,我想创建一个表 '附着' 有以下的列: 'FILE_PATH'=>串 'MESSAGE_ID'=>整数Symfony 1.4教条创建表

由于

回答

1

发现:

$this->createTable('attachment', array(
     'id' => 
      array(
       'type' => 'integer', 
       'length' => 8, 
       'autoincrement' => true, 
       'primary' => true, 
      ), 
     'file_path' => 
      array(
       'type' => 'string', 
       'notnull' => true, 
       'length' => 255, 
      ), 
     'message_id' => 
      array(
       'type' => 'integer', 
       'notnull' => false, 
       'length' => 8, 
      ), 
     'created_at' => 
      array(
       'notnull' => true, 
       'type' => 'timestamp', 
       'length' => 25, 
      ), 
     'updated_at' => 
      array(
       'notnull' => true, 
       'type' => 'timestamp', 
       'length' => 25, 
      ), 
    ), array(
     'indexes' => 
      array(
      ), 
     'primary' => 
      array(
       0 => 'id', 
      ), 
     'collate' => 'utf8_general_ci', 
     'charset' => 'utf8', 
    ));