Gentics Portal.Node PHP API
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Pages
common
migrations
m121205_102018_vote.php
1
<?php
2
3
class
m121205_102018_vote
extends
CDbMigration
4
{
5
// Use safeUp/safeDown to do migration with transaction
6
public
function
safeUp()
7
{
8
$this->createTable(
'{{question}}'
, array(
9
'id'
=>
'string'
,
10
'author_id'
=>
'integer'
,
11
'text'
=>
'text'
,
12
'created'
=>
'datetime'
,
13
'PRIMARY KEY (id)'
14
));
15
$this->createTable(
'{{answer}}'
, array(
16
'id'
=>
'pk'
,
17
'question_id'
=>
'string'
,
18
'answer_key'
=>
'string'
,
19
'order'
=>
'integer DEFAULT 0'
,
20
'text'
=>
'text'
,
21
'active'
=>
'integer'
,
22
'created'
=>
'datetime'
,
23
));
24
$this->createIndex(
'question_id_idx'
,
'{{answer}}'
,
'question_id'
);
25
$this->createTable(
'{{user_answer}}'
, array(
26
'answer_id'
=>
'integer'
,
27
'user_id'
=>
'string'
,
//for anonymous user use session id as key
28
'additional'
=>
'text'
,
29
'created'
=>
'datetime'
,
30
));
31
$this->createIndex(
'answer_user_id_idx'
,
'{{user_answer}}'
,
'user_id'
);
32
}
33
34
public
function
safeDown()
35
{
36
$this->dropTable(
'{{question}}'
);
37
$this->dropTable(
'{{answer}}'
);
38
$this->dropTable(
'{{user_answer}}'
);
39
}
40
41
}
Generated on Thu Feb 6 2014 15:47:54 for Gentics Portal.Node PHP API by
1.8.1.2