👁 查看:001_initialize.php
路径:/virtual/bigbrother/sns/data/migrations/3.0.2/001_initialize.php
大小:1.27 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

class initialize extends opMigration
{
  public function up()
  {
    try
    {
      $conn = Doctrine_Manager::connection();

      $conn->export->alterTable('member', array('add' => array(
        'invite_member_id' => array(
          'type' => 'integer',
          'size' => 11,
        ),
      )));

      $conn->export->createForeignKey('member', array(
        'name'         => 'member_FI_1',
        'local'        => 'invite_member_id',
        'foreign'      => 'id',
        'foreignTable' => 'member',
        'onDelete'     => 'SET NULL'
      ));
    }
    catch (Doctrine_Connection_Exception $e)
    {
      // FIXME: this script should check only "column already exists" error.
      $syntaxErrorCode = 42;

      // do nothing when the error is "already exists" because it is caused the following reasons:
      //   * the SNS has been created or rebuilt on since 3.0.1
      //   * the "openpne:update" task has been executed
      if ($e->getCode() != $syntaxErrorCode)
      {
        throw $e;
      }
    }
  }
}
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ