本文整理汇总了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager::dropTable方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractSchemaManager::dropTable方法的具体用法?PHP AbstractSchemaManager::dropTable怎么用?PHP AbstractSchemaManager::dropTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\AbstractSchemaManager
的用法示例。
在下文中一共展示了AbstractSchemaManager::dropTable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteModel
/**
* Drop database represented by the model.
*
* @param Model $model
*
* @since 1.1.0
*
* @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
*/
public function deleteModel($model)
{
// first remove any automatically created models
/** @var $relationField ManyToManyField */
foreach ($model->meta->localManyToMany as $name => $relationField) {
if ($relationField->relation->through->meta->autoCreated) {
$this->deleteModel($relationField->relation->through);
}
}
$this->schemaManager->dropTable($model->meta->dbTable);
}
示例2: createTable
/**
* @param AbstractSchemaManager $schemaM
* @param Schema $schema
*
* @since 1.1.0
*
* @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
*/
public function createTable($schemaM, $schema)
{
if ($schemaM->tablesExist('artists')) {
$schemaM->dropTable('artists');
}
if ($schemaM->tablesExist('user')) {
$schemaM->dropTable('user');
}
echo 'Tables :: ';
$UTable = $schema->createTable('user');
$UTable->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]);
$UTable->addColumn('name', 'string', ['length' => 60]);
$UTable->setPrimaryKey(['id']);
$myTable = $schema->createTable('artists');
$myTable->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]);
$myTable->addColumn('user_id', 'integer', ['unsigned' => true]);
$myTable->addColumn('name', 'string', ['length' => 60]);
$myTable->setPrimaryKey(['id']);
$myTable->addForeignKeyConstraint($UTable, array('user_id'), array('id'), array('onUpdate' => 'CASCADE'));
$schemaM->createTable($UTable);
$schemaM->createTable($myTable);
}
示例3: executeChanges
/**
* Executes the changes.
*/
public function executeChanges()
{
$platform = $this->db->getDatabasePlatform();
if (!empty($this->dropTables)) {
foreach ($this->dropTables as $t) {
$this->sm->dropTable($this->prefix . $t);
}
}
$sql = $this->schema->toSql($platform);
if (!empty($sql)) {
foreach ($sql as $s) {
$this->db->executeUpdate($s);
}
}
//reset schema
$this->schema = new Schema([], [], $this->sm->createSchemaConfig());
$this->dropTables = $this->addTables = [];
}
示例4: dropTable
/**
* {@inheritdoc}
*/
public function dropTable($name)
{
$this->tryMethod('dropAutoincrement', $name);
parent::dropTable($name);
}
示例5: dropTable
/**
* @see AbstractSchemaManager::dropTable
*/
public function dropTable($table)
{
$this->manager->dropTable($this->replacePrefix($table));
}
示例6: tearDown
public function tearDown()
{
foreach ($this->_sm->listTableNames() as $tableName) {
$this->_sm->dropTable($tableName);
}
}