Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
m120516_141158_user_personalisation.php
1 <?php
2 
3 class m120516_141158_user_personalisation extends CDbMigration
4 {
5  public function safeUp()
6  {
7  $this->createTable('{{personalisation_attributes}}', array(
8  'id' => 'pk',
9  'parent_id' => 'integer',
10  'name' => 'string NOT NULL',
11  'title' => 'string NOT NULL',
12  'path' => 'text NOT NULL DEFAULT \'\'',
13  ));
14  $this->createIndex('personalisation_attributes_parent_id_idx', '{{personalisation_attributes}}', 'parent_id');
15 
16  $this->createTable('{{user_personalisation_attributes}}', array(
17  'user_id' => 'integer NOT NULL',
18  'personalisation_attribute_id' => 'integer NOT NULL',
19  ));
20 
21  $this->execute('ALTER TABLE {{user_personalisation_attributes}} ADD PRIMARY KEY (user_id, personalisation_attribute_id)');
22 
23  }
24 
25  public function safeDown()
26  {
27  $this->dropTable('{{personalisation_attributes}}');
28  $this->dropTable('{{user_personalisation_attributes}}');
29  }
30 
31  /*
32  // Use safeUp/safeDown to do migration with transaction
33  public function safeUp()
34  {
35  }
36 
37  public function safeDown()
38  {
39  }
40  */
41 }