Symfony 1.4 doctrine创建表

时间:2014-09-04 09:44:34

标签: doctrine symfony-1.4 dql

有人能告诉我一个如何在Doctrine中使用createTable的例子吗? 例如,我想创建一个表格附件'使用以下列: ' FILE_PATH' =>串 ' MESSAGE_ID' = GT;整数

由于

1 个答案:

答案 0 :(得分: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',
    ));