Elgg  Version 5.1
20170728075129_create_river_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateRiverTable extends AbstractMigration {
32  public function change() {
33 
34  if ($this->hasTable("river")) {
35  return;
36  }
37 
38  $table = $this->table("river", [
39  'engine' => "InnoDB",
40  'encoding' => "utf8mb4",
41  'collation' => "utf8mb4_general_ci",
42  ]);
43 
44  $table->addColumn('type', 'string', [
45  'null' => false,
46  'limit' => 8,
47  ]);
48 
49  $table->addColumn('subtype', 'string', [
50  'null' => false,
51  'limit' => 32,
52  ]);
53 
54  $table->addColumn('action_type', 'string', [
55  'null' => false,
56  'limit' => 32,
57  ]);
58 
59  $table->addColumn('access_id', 'integer', [
60  'null' => false,
61  'limit' => MysqlAdapter::INT_REGULAR,
62  'precision' => 11,
63  ]);
64 
65  $table->addColumn('view', 'text', [
66  'null' => false,
67  ]);
68 
69  $table->addColumn('subject_guid', 'integer', [
70  'null' => false,
71  'limit' => MysqlAdapter::INT_BIG,
72  'precision' => 20,
73  'signed' => false,
74  ]);
75 
76  $table->addColumn('object_guid', 'integer', [
77  'null' => false,
78  'limit' => MysqlAdapter::INT_BIG,
79  'precision' => 20,
80  'signed' => false,
81  ]);
82 
83  $table->addColumn('target_guid', 'integer', [
84  'null' => false,
85  'limit' => MysqlAdapter::INT_BIG,
86  'precision' => 20,
87  'signed' => false,
88  ]);
89 
90  $table->addColumn('annotation_id', 'integer', [
91  'null' => false,
92  'limit' => MysqlAdapter::INT_REGULAR,
93  'precision' => 11,
94  ]);
95 
96  $table->addColumn('posted', 'integer', [
97  'null' => false,
98  'limit' => MysqlAdapter::INT_REGULAR,
99  'precision' => 11,
100  ]);
101 
102  $table->addColumn('enabled', 'enum', [
103  'null' => false,
104  'default' => 'yes',
105  'limit' => 3,
106  'values' => [
107  'yes',
108  'no'
109  ],
110  ]);
111 
112  $table->addIndex(['type'], [
113  'name' => "type",
114  'unique' => false,
115  ]);
116 
117  $table->addIndex(['action_type'], [
118  'name' => "action_type",
119  'unique' => false,
120  ]);
121 
122  $table->addIndex(['access_id'], [
123  'name' => "access_id",
124  'unique' => false,
125  ]);
126 
127  $table->addIndex(['subject_guid'], [
128  'name' => "subject_guid",
129  'unique' => false,
130  ]);
131 
132  $table->addIndex(['object_guid'], [
133  'name' => "object_guid",
134  'unique' => false,
135  ]);
136 
137  $table->addIndex(['target_guid'], [
138  'name' => "target_guid",
139  'unique' => false,
140  ]);
141 
142  $table->addIndex(['annotation_id'], [
143  'name' => "annotation_id",
144  'unique' => false,
145  ]);
146 
147  $table->addIndex(['posted'], [
148  'name' => "posted",
149  'unique' => false,
150  ]);
151 
152  $table->save();
153 
154  }
155 }
change()
CREATE TABLE prefix_river ( id int(11) NOT NULL AUTO_INCREMENT, type varchar(8) NOT NULL...
$table
Definition: user.php:37