Yii の移行に問題があります。問題は、移行が成功した後に正常に実行されたコードを移行したことです。別の移行コードを試しましたが、最初の移行コードと移行が必要な 2 番目の移行コードが表示されました。続けて、yii に移行を続行するように指示したところ、その後、移行が既に行われているというエラーが表示されました。これは、既に行った移行であり、2 回目の移行を行うことができませんでした。次に、最初の移行コードを削除し、2 つ目のコードを移行しました。コードは正常に実行されましたが、テーブルは作成されませんでした。誰かがこれに対する解決策を持っていますか、なぜ私の移行が行われていないのか、そしてはい、私が実行した2番目のコード、最後のテーブルは移行フォルダーのsafeup()とsafedown()にあります。
これは私のコードですが、再びエラーが発生します。実際には trackstar プロジェクトから yii を学んでいます。それで、これは私のコードです。私はそれをup関数に再びエラーとして残しました。見てもらえますか
public function up()
{
//create the issue table
$this->createTable('tbl_issue', array(
'id' => 'pk',
'name' => 'string NOT NULL',
'description' => 'text',
'project_id' => 'int(11) DEFAULT NULL',
'type_id' => 'int(11) DEFAULT NULL',
'status_id' => 'int(11) DEFAULT NULL',
'owner_id' => 'int(11) DEFAULT NULL',
'requester_id' => 'int(11) DEFAULT NULL',
'create_time' => 'datetime DEFAULT NULL',
'create_user_id' => 'int(11) DEFAULT NULL',
'update_time' => 'datetime DEFAULT NULL',
'update_user_id' => 'int(11) DEFAULT NULL',
), 'ENGINE=InnoDB');
//create the user table
$this->createTable('tbl_user', array(
'id' => 'pk',
'username' => 'string NOT NULL',
'email' => 'string NOT NULL',
'password' => 'string NOT NULL',
'last_login_time' => 'datetime DEFAULT NULL',
'create_time' => 'datetime DEFAULT NULL',
'create_user_id' => 'int(11) DEFAULT NULL',
'update_time' => 'datetime DEFAULT NULL',
'update_user_id' => 'int(11) DEFAULT NULL',
), 'ENGINE=InnoDB');
//create the assignment table that allows for many-to-many
//relationship between projects and users
$this->createTable('tbl_project_user_assignment', array(
'project_id' => 'int(11) NOT NULL',
'user_id' => 'int(11) NOT NULL',
'PRIMARY KEY (`project_id`,`user_id`)',
), 'ENGINE=InnoDB');
//foreign key relationships
//the tbl_issue.project_id is a reference to tbl_project.id
$this->addForeignKey("fk_issue_project", "tbl_issue", "project_
id", "tbl_project", "id", "CASCADE", "RESTRICT");
//the tbl_issue.owner_id is a reference to tbl_user.id
$this->addForeignKey("fk_issue_owner", "tbl_issue", "owner_id",
"tbl_user", "id", "CASCADE", "RESTRICT");
//the tbl_issue.requester_id is a reference to tbl_user.id
$this->addForeignKey("fk_issue_requester", "tbl_issue",
"requester_id", "tbl_user", "id", "CASCADE", "RESTRICT");
//the tbl_project_user_assignment.project_id is a reference totbl_project.id
$this->addForeignKey("fk_project_user", "tbl_project_user_
assignment", "project_id", "tbl_project", "id", "CASCADE",
"RESTRICT");
//the tbl_project_user_assignment.user_id is a reference to tbl_user.id
$this->addForeignKey("fk_user_project", "tbl_project_user_
assignment", "user_id", "tbl_user", "id", "CASCADE", "RESTRICT");
}
public function down()
{
$this->truncateTable('tbl_project_user_assignment');
$this->truncateTable('tbl_issue');
$this->truncateTable('tbl_user');
$this->dropTable('tbl_project_user_assignment');
$this->dropTable('tbl_issue');
$this->dropTable('tbl_user');
}
`
移行コードが貼り付けられているのは、これが今表示され始めたエラーです。ここにドロップボックスへのリンク、これが表示されているエラーです ここにリンクの説明を入力してください