本文整理汇总了PHP中Doctrine\DBAL\Schema\Schema::renameTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::renameTable方法的具体用法?PHP Schema::renameTable怎么用?PHP Schema::renameTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Schema
的用法示例。
在下文中一共展示了Schema::renameTable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renameTable
/**
* Renames a table.
*
* @param string $oldTableName
* @param string $newTableName
*
* @return \Speedwork\Database\Migration\Schema
*/
public function renameTable($oldTable, $newTable)
{
$oldTable = $this->addPrefix($oldTable);
$newTable = $this->addPrefix($newTable);
$this->schema->renameTable($oldTable, $newTable);
return $this;
}
示例2: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('UPDATE user SET username_canonical = username');
$this->addSql('ALTER TABLE user ADD confirmation_token VARCHAR(255) NULL');
$this->addSql('ALTER TABLE user ADD password_requested_at DATETIME DEFAULT NULL');
$schema->renameTable('track_e_exercices', 'track_e_exercises');
}
示例3: testRenameTable
public function testRenameTable()
{
$tableName = "foo";
$table = new Table($tableName);
$schema = new Schema(array($table));
$this->assertTrue($schema->hasTable("foo"));
$schema->renameTable("foo", "bar");
$this->assertFalse($schema->hasTable("foo"));
$this->assertTrue($schema->hasTable("bar"));
$this->assertSame($table, $schema->getTable("bar"));
}
示例4: up
//.........这里部分代码省略.........
$this->addSql('ALTER TABLE c_item_property MODIFY COLUMN start_visible datetime default NULL');
$this->addSql('ALTER TABLE c_item_property MODIFY COLUMN end_visible datetime default NULL');
$this->addSql('ALTER TABLE c_group_info MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_group_info MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_group_info MODIFY session_id INT NOT NULL');
$this->addSql('ALTER TABLE c_group_info DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_group_info ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE usergroup_rel_tag ADD INDEX usergroup_rel_tag_usergroup_id ( usergroup_id )');
$this->addSql('ALTER TABLE usergroup_rel_tag ADD INDEX usergroup_rel_tag_tag_id (tag_id)');
$this->addSql('ALTER TABLE usergroup_rel_user ADD COLUMN relation_type int NOT NULL default 0');
$this->addSql('ALTER TABLE usergroup_rel_user ADD INDEX usergroup_rel_user_usergroup_id (usergroup_id)');
$this->addSql('ALTER TABLE usergroup_rel_user ADD INDEX usergroup_rel_user_user_id (user_id)');
$this->addSql('ALTER TABLE usergroup_rel_user ADD INDEX usergroup_rel_user_relation_type (relation_type)');
$this->addSql('ALTER TABLE usergroup_rel_usergroup ADD INDEX usergroup_rel_usergroup_group_id( group_id )');
$this->addSql('ALTER TABLE usergroup_rel_usergroup ADD INDEX usergroup_rel_usergroup_subgroup_id( subgroup_id )');
$this->addSql('ALTER TABLE usergroup_rel_usergroup ADD INDEX usergroup_rel_usergroup_relation_type( relation_type )');
$this->addSql('ALTER TABLE announcement_rel_group DROP PRIMARY KEY');
$this->addSql('ALTER TABLE announcement_rel_group ADD COLUMN id INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE track_e_hotpotatoes ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_exercices ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_attempt ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_hotspot ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_course_access ADD COLUMN c_id INT NOT NULL DEFAULT 0');
$this->addSql('ALTER TABLE access_url_rel_course ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_lastaccess ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_access ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_downloads ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_links ADD COLUMN c_id int unsigned NOT NULL default 0');
$this->addSql('ALTER TABLE track_e_lastaccess ADD INDEX track_e_lastaccess_c_id_access_user_id (c_id, access_user_id)');
$this->addSql('ALTER TABLE access_url_rel_course DROP PRIMARY KEY');
$this->addSql('ALTER TABLE access_url_rel_course ADD COLUMN id int unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz ADD COLUMN autolaunch int DEFAULT 0');
//$this->addSql('RENAME TABLE c_quiz_question_category TO c_quiz_category');
$schema->renameTable('c_quiz_question_category', 'c_quiz_category');
$this->addSql('ALTER TABLE c_quiz_category ADD COLUMN parent_id int unsigned default NULL');
$this->addSql('ALTER TABLE c_quiz DROP INDEX session_id');
$this->addSql('ALTER TABLE c_quiz MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_question MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_question MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_question DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_question ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_answer MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_answer MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_answer MODIFY id_auto INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_answer DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_answer ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_answer ADD INDEX idx_cqa_qid (question_id)');
$this->addSql('ALTER TABLE c_quiz_question_option MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_question_option MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_question_option DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_question_option ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_rel_question MODIFY question_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_rel_question MODIFY exercice_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_rel_question DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_rel_question ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_id (question_id)');
$this->addSql('ALTER TABLE c_quiz_rel_question ADD INDEX idx_cqrq_cidexid (c_id, exercice_id)');
$this->addSql('ALTER TABLE c_quiz_category MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_category MODIFY c_id INT NOT NULL');
$this->addSql('ALTER TABLE c_quiz_category DROP PRIMARY KEY');
$this->addSql('ALTER TABLE c_quiz_category ADD COLUMN iid INT unsigned NOT NULL auto_increment PRIMARY KEY');
$this->addSql('ALTER TABLE question_field_options ADD INDEX idx_question_field_options_field_id(field_id)');
$this->addSql('ALTER TABLE question_field_values ADD INDEX idx_question_field_values_question_id(question_id)');
示例5: rename
/**
* Rename a table on the schema.
*
* @param string $from
* @param string $to
*
* @return Schema
*/
public function rename($from, $to)
{
return $this->schema->renameTable($from, $to);
}