當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Migration::dropTable方法代碼示例

本文整理匯總了PHP中yii\db\Migration::dropTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP Migration::dropTable方法的具體用法?PHP Migration::dropTable怎麽用?PHP Migration::dropTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\db\Migration的用法示例。


在下文中一共展示了Migration::dropTable方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dropTable

 public function dropTable()
 {
     if ($this->dropOriginTable) {
         if (in_array($this->tableNameRaw, $this->_connection->schema->tableNames)) {
             $schema = $this->_connection->schema->getTableSchema($this->tableNameRaw);
             if ($schema) {
                 $keys = $schema->foreignKeys;
                 if (is_array($keys)) {
                     foreach ($keys as $name => $_next) {
                         $t = [];
                         foreach ($_next as $k => $v) {
                             if (!$k) {
                                 $t['related_table'] = $v;
                             } else {
                                 $t['related_field'] = $v;
                                 $t['field'] = $k;
                             }
                         }
                         try {
                             $keyName = $this->getNameForeignKey($this->tableNameRaw, $t['related_table'], $_next[$t['field']], $t['related_field'], 255);
                             if ($this->hideMigrationOutput) {
                                 ob_start();
                             }
                             $this->migrationClass->dropForeignKey($keyName, $this->tableNameRaw);
                             if ($this->hideMigrationOutput) {
                                 ob_clean();
                                 ob_flush();
                             }
                         } catch (\yii\db\Exception $exp) {
                         }
                     }
                 }
                 if ($this->hideMigrationOutput) {
                     ob_start();
                 }
                 try {
                     $this->migrationClass->dropTable($this->tableNameRaw);
                 } catch (\yii\db\Exception $exp) {
                 } catch (IntegrityException $exp) {
                 }
                 if ($this->hideMigrationOutput) {
                     ob_clean();
                     ob_flush();
                 }
             }
         }
     }
 }
開發者ID:infinitydevphp,項目名稱:yii2-table-builder,代碼行數:48,代碼來源:TableBuilder.php

示例2: afterDelete

 /**
  * @inheritdoc
  */
 public function afterDelete()
 {
     parent::afterDelete();
     $migrate = new Migration();
     $table = self::getTable($this->tab_index, $this->tab);
     $migrate->dropTable($table);
     //return true;
 }
開發者ID:jackieit,項目名稱:aimocms,代碼行數:11,代碼來源:Cm.php

示例3: dropTable

 /**
  * @inheritdoc
  * Note: table will be auto pefixied if [[$autoWrapTableNames]] is true.
  */
 public function dropTable($table)
 {
     $table = $this->autoWrappedTableName($table);
     return parent::dropTable($table);
 }
開發者ID:flexibuild,項目名稱:migrate,代碼行數:9,代碼來源:Migration.php

示例4: migrateDown

 /**
  * @param Migration $migration
  * @param string $tableName
  */
 public static function migrateDown($migration, $tableName = '{{%files}}')
 {
     $migration->dropTable($tableName);
 }
開發者ID:omnilight,項目名稱:yii2-models,代碼行數:8,代碼來源:FileMigration.php


注:本文中的yii\db\Migration::dropTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。