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


PHP Schema::rename方法代碼示例

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


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

示例1: up

 public function up()
 {
     // change country_041
     DBLibrary::renameColumnWithForeignKey('005_041_contact', 'country_041', 'country_id_041', 'VARCHAR', 2, false, false, 'fk01_005_041_contact', '001_002_country', 'id_002');
     // change group_042
     DBLibrary::renameColumnWithForeignKey('005_042_contacts_groups', 'group_042', 'group_id_042', 'INT', 10, true, false, 'fk01_005_042_contacts_groups', '005_040_group', 'id_040', 'cascade', 'cascade');
     // change contact_042
     DBLibrary::renameColumnWithForeignKey('005_042_contacts_groups', 'contact_042', 'contact_id_042', 'INT', 10, true, false, 'fk02_005_042_contacts_groups', '005_041_contact', 'id_041', 'cascade', 'cascade');
     // change email_account_044
     DBLibrary::renameColumnWithForeignKey('005_044_email_campaign', 'email_account_044', 'email_account_id_044', 'INT', 10, true, false, 'fk01_005_044_email_campaign', '001_013_email_account', 'id_013');
     // change template_044
     DBLibrary::renameColumnWithForeignKey('005_044_email_campaign', 'template_044', 'template_id_044', 'INT', 10, true, true, 'fk02_005_044_email_campaign', '005_043_email_template', 'id_043');
     // change campaign_045
     DBLibrary::renameColumnWithForeignKey('005_045_email_campaigns_countries', 'campaign_045', 'campaign_id_045', 'INT', 10, true, false, 'fk01_005_045_email_campaigns_countries', '005_044_email_campaign', 'id_044', 'cascade', 'cascade');
     // change country_045
     DBLibrary::renameColumnWithForeignKey('005_045_email_campaigns_countries', 'country_045', 'country_id_045', 'VARCHAR', 2, false, false, 'fk02_005_045_email_campaigns_countries', '001_002_country', 'id_002', 'cascade', 'cascade');
     // change campaign_046
     DBLibrary::renameColumnWithForeignKey('005_046_email_campaigns_groups', 'campaign_046', 'campaign_id_046', 'INT', 10, true, false, 'fk01_005_046_email_campaigns_groups', '005_044_email_campaign', 'id_044', 'cascade', 'cascade');
     // change group_046
     DBLibrary::renameColumnWithForeignKey('005_046_email_campaigns_groups', 'group_046', 'group_id_046', 'INT', 10, true, false, 'fk02_005_046_email_campaigns_groups', '005_040_group', 'id_040', 'cascade', 'cascade');
     // change campaign_047
     DBLibrary::renameColumnWithForeignKey('005_047_email_send_queue', 'campaign_047', 'campaign_id_047', 'INT', 10, true, false, 'fk01_005_047_email_send_queue', '005_044_email_campaign', 'id_044', 'cascade', 'cascade');
     // change contact_047
     DBLibrary::renameColumnWithForeignKey('005_047_email_send_queue', 'contact_047', 'contact_id_047', 'INT', 10, true, false, 'fk02_005_047_email_send_queue', '005_041_contact', 'id_041', 'cascade', 'cascade');
     // rename columns
     // status_047
     DBLibrary::renameColumn('005_047_email_send_queue', 'status_047', 'status_id_047', 'TINYINT', 3, true, false, 0);
     // rename table
     if (Schema::hasTable('005_048_email_send_historical')) {
         Schema::rename('005_048_email_send_historical', '005_048_email_send_history');
     }
     // change send_queue_048
     DBLibrary::renameColumnWithForeignKey('005_048_email_send_history', 'send_queue_048', 'send_queue_id_048', 'BIGINT', 20, true, true, 'fk01_005_048_email_send_history', '005_047_email_send_queue', 'id_047', 'set null', 'cascade');
     // change campaign_048
     DBLibrary::renameColumnWithForeignKey('005_048_email_send_history', 'campaign_048', 'campaign_id_048', 'INT', 10, true, false, 'fk02_005_048_email_send_history', '005_044_email_campaign', 'id_044', 'cascade', 'cascade');
     // change contact_048
     DBLibrary::renameColumnWithForeignKey('005_048_email_send_history', 'contact_048', 'contact_id_048', 'INT', 10, true, false, 'fk03_005_048_email_send_history', '005_041_contact', 'id_041', 'cascade', 'cascade');
 }
開發者ID:syscover,項目名稱:comunik,代碼行數:38,代碼來源:2003_01_01_000002_comunik_updateV2.php

示例2: correctNameForPiggyBankEvents

 public function correctNameForPiggyBankEvents()
 {
     Schema::rename('piggybank_events', 'piggy_bank_events');
 }
開發者ID:webenhanced,項目名稱:firefly-iii,代碼行數:4,代碼來源:2014_12_13_190730_changes_for_v321.php

示例3: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     if (Schema::hasTable('districts')) {
         Schema::rename('districts', 'ward_districts');
     }
 }
開發者ID:joshdavis11,項目名稱:hometeachme,代碼行數:11,代碼來源:2016_02_11_025551_change_ward_districts_to_districts.php

示例4: renamePiggyBankEvents

 private function renamePiggyBankEvents()
 {
     Schema::rename('piggy_bank_events', 'piggybank_events');
 }
開發者ID:zjean,項目名稱:firefly-iii,代碼行數:4,代碼來源:2014_12_13_190730_changes_for_v321.php


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