Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
m120501_115457_custom_user_fields.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  */
10 class m120501_115457_custom_user_fields extends CDbMigration
11 {
12  public function safeUp()
13  {
14  try{
15  $this->renameColumn('{{profiles}}', 'buisness_zip', 'business_zip');
16  $this->renameColumn('{{profiles}}', 'buisness_country', 'business_country');
17  $this->renameColumn('{{profiles}}', 'buisness_phone_number', 'business_phone_number');
18  $this->renameColumn('{{profiles}}', 'buisness_mobile_phone_number', 'business_mobile_phone_number');
19  $this->renameColumn('{{profiles}}', 'buisness_city', 'business_city');
20 
21  $this->update("{{profiles_fields}}", array("varname" => "business_zip"), "varname='buisness_zip'");
22  $this->update("{{profiles_fields}}", array("varname" => "business_country"), "varname='buisness_country'");
23  $this->update("{{profiles_fields}}", array("varname" => "business_phone_number"), "varname='buisness_phone_number'");
24  $this->update("{{profiles_fields}}", array("varname" => "business_mobile_phone_number"), "varname='buisness_mobile_phone_number'");
25  $this->update("{{profiles_fields}}", array("varname" => "business_city"), "varname='buisness_city'");
26  }catch (Exception $e){}
27  }
28 
29  public function safeDown()
30  {
31  $this->renameColumn("{{profiles}}", "business_zip", "buisness_zip");
32  $this->renameColumn("{{profiles}}", "business_country", "buisness_country");
33  $this->renameColumn("{{profiles}}", "business_phone_number", "buisness_phone_number");
34  $this->renameColumn("{{profiles}}", "business_mobile_phone_number", "buisness_mobile_phone_number");
35  $this->renameColumn("{{profiles}}", "business_city", "buisness_city");
36 
37  $this->update("{{profiles_fields}}", array("varname" => "buisness_zip"), "varname='business_zip'");
38  $this->update("{{profiles_fields}}", array("varname" => "buisness_country"), "varname='business_country'");
39  $this->update("{{profiles_fields}}", array("varname" => "buisness_phone_number"), "varname='business_phone_number'");
40  $this->update("{{profiles_fields}}", array("varname" => "buisness_mobile_phone_number"), "varname='business_mobile_phone_number'");
41  $this->update("{{profiles_fields}}", array("varname" => "buisness_city"), "varname='business_city'");
42 
43  return true;
44  }
45 
46  /*
47  // Use safeUp/safeDown to do migration with transaction
48  public function safeUp()
49  {
50  }
51 
52  public function safeDown()
53  {
54  }
55  */
56 }