| @@ 145-176 (lines=32) @@ | ||
| 142 | } |
|
| 143 | ||
| 144 | ||
| 145 | if (!$schema->hasTable('circle_clouds')) { |
|
| 146 | $table = $schema->createTable('circle_clouds'); |
|
| 147 | $table->addColumn( |
|
| 148 | 'cloud_id', 'string', [ |
|
| 149 | 'notnull' => true, |
|
| 150 | 'length' => 64, |
|
| 151 | ] |
|
| 152 | ); |
|
| 153 | $table->addColumn( |
|
| 154 | 'address', 'string', [ |
|
| 155 | 'notnull' => true, |
|
| 156 | 'length' => 255, |
|
| 157 | ] |
|
| 158 | ); |
|
| 159 | $table->addColumn( |
|
| 160 | 'status', 'smallint', [ |
|
| 161 | 'notnull' => true, |
|
| 162 | 'length' => 1, |
|
| 163 | ] |
|
| 164 | ); |
|
| 165 | $table->addColumn( |
|
| 166 | 'note', 'text', [ |
|
| 167 | 'notnull' => false |
|
| 168 | ] |
|
| 169 | ); |
|
| 170 | $table->addColumn( |
|
| 171 | 'created', 'datetime', [ |
|
| 172 | 'notnull' => false, |
|
| 173 | ] |
|
| 174 | ); |
|
| 175 | $table->setPrimaryKey(['cloud_id']); |
|
| 176 | } |
|
| 177 | ||
| 178 | ||
| 179 | if (!$schema->hasTable('circle_groups')) { |
|
| @@ 179-210 (lines=32) @@ | ||
| 176 | } |
|
| 177 | ||
| 178 | ||
| 179 | if (!$schema->hasTable('circle_groups')) { |
|
| 180 | $table = $schema->createTable('circle_groups'); |
|
| 181 | $table->addColumn( |
|
| 182 | 'circle_id', 'string', [ |
|
| 183 | 'notnull' => true, |
|
| 184 | 'length' => 15, |
|
| 185 | ] |
|
| 186 | ); |
|
| 187 | $table->addColumn( |
|
| 188 | 'group_id', 'string', [ |
|
| 189 | 'notnull' => true, |
|
| 190 | 'length' => 64, |
|
| 191 | ] |
|
| 192 | ); |
|
| 193 | $table->addColumn( |
|
| 194 | 'level', 'smallint', [ |
|
| 195 | 'notnull' => true, |
|
| 196 | 'length' => 1, |
|
| 197 | ] |
|
| 198 | ); |
|
| 199 | $table->addColumn( |
|
| 200 | 'note', 'text', [ |
|
| 201 | 'notnull' => false |
|
| 202 | ] |
|
| 203 | ); |
|
| 204 | $table->addColumn( |
|
| 205 | 'joined', 'datetime', [ |
|
| 206 | 'notnull' => false, |
|
| 207 | ] |
|
| 208 | ); |
|
| 209 | $table->setPrimaryKey(['circle_id', 'group_id']); |
|
| 210 | } |
|
| 211 | ||
| 212 | ||
| 213 | if (!$schema->hasTable('circle_gsevents')) { |
|
| @@ 310-337 (lines=28) @@ | ||
| 307 | } |
|
| 308 | ||
| 309 | ||
| 310 | if (!$schema->hasTable('circle_gsshares_mp')) { |
|
| 311 | $table = $schema->createTable('circle_gsshares_mp'); |
|
| 312 | $table->addColumn( |
|
| 313 | 'share_id', 'integer', [ |
|
| 314 | 'length' => 11, |
|
| 315 | 'notnull' => false |
|
| 316 | ] |
|
| 317 | ); |
|
| 318 | $table->addColumn( |
|
| 319 | 'user_id', 'string', [ |
|
| 320 | 'length' => 127, |
|
| 321 | 'notnull' => false |
|
| 322 | ] |
|
| 323 | ); |
|
| 324 | $table->addColumn( |
|
| 325 | 'mountpoint', 'text', [ |
|
| 326 | 'notnull' => false |
|
| 327 | ] |
|
| 328 | ); |
|
| 329 | $table->addColumn( |
|
| 330 | 'mountpoint_hash', 'string', [ |
|
| 331 | 'length' => 64, |
|
| 332 | 'notnull' => false |
|
| 333 | ] |
|
| 334 | ); |
|
| 335 | $table->setPrimaryKey(['share_id', 'user_id']); |
|
| 336 | $table->addUniqueIndex(['share_id', 'mountpoint_hash']); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | if (!$schema->hasTable('circle_links')) { |
|
| @@ 162-192 (lines=31) @@ | ||
| 159 | $table->addIndex(['href']); |
|
| 160 | } |
|
| 161 | ||
| 162 | if (!$schema->hasTable('circle_memberships')) { |
|
| 163 | $table = $schema->createTable('circle_memberships'); |
|
| 164 | ||
| 165 | $table->addColumn( |
|
| 166 | 'id', 'string', [ |
|
| 167 | 'notnull' => true, |
|
| 168 | 'length' => 15, |
|
| 169 | ] |
|
| 170 | ); |
|
| 171 | $table->addColumn( |
|
| 172 | 'circle_id', 'string', [ |
|
| 173 | 'notnull' => true, |
|
| 174 | 'length' => 15, |
|
| 175 | ] |
|
| 176 | ); |
|
| 177 | $table->addColumn( |
|
| 178 | 'member_id', 'string', [ |
|
| 179 | 'notnull' => true, |
|
| 180 | 'length' => 15, |
|
| 181 | ] |
|
| 182 | ); |
|
| 183 | $table->addColumn( |
|
| 184 | 'level', 'integer', [ |
|
| 185 | 'notnull' => true, |
|
| 186 | 'length' => 1, |
|
| 187 | 'unsigned' => true |
|
| 188 | ] |
|
| 189 | ); |
|
| 190 | ||
| 191 | $table->addIndex(['id']); |
|
| 192 | } |
|
| 193 | ||
| 194 | return $schema; |
|
| 195 | } |
|