| @@ 35-67 (lines=33) @@ | ||
| 32 | /** @var ISchemaWrapper $schema */ |
|
| 33 | $schema = $schemaClosure(); |
|
| 34 | ||
| 35 | if (!$schema->hasTable('circles_circles')) { |
|
| 36 | $table = $schema->createTable('circles_circles'); |
|
| 37 | $table->addColumn('id', 'integer', [ |
|
| 38 | 'autoincrement' => true, |
|
| 39 | 'notnull' => true, |
|
| 40 | 'length' => 4, |
|
| 41 | 'unsigned' => true, |
|
| 42 | ]); |
|
| 43 | $table->addColumn('unique_id', 'string', [ |
|
| 44 | 'notnull' => true, |
|
| 45 | 'length' => 64, |
|
| 46 | ]); |
|
| 47 | $table->addColumn('name', 'string', [ |
|
| 48 | 'notnull' => true, |
|
| 49 | 'length' => 64, |
|
| 50 | ]); |
|
| 51 | $table->addColumn('description', 'string', [ |
|
| 52 | 'notnull' => false, |
|
| 53 | 'length' => 4000, |
|
| 54 | ]); |
|
| 55 | $table->addColumn('settings', 'string', [ |
|
| 56 | 'notnull' => false, |
|
| 57 | 'length' => 4000, |
|
| 58 | ]); |
|
| 59 | $table->addColumn('type', 'smallint', [ |
|
| 60 | 'notnull' => true, |
|
| 61 | 'length' => 2, |
|
| 62 | ]); |
|
| 63 | $table->addColumn('creation', 'datetime', [ |
|
| 64 | 'notnull' => false, |
|
| 65 | ]); |
|
| 66 | $table->setPrimaryKey(['id']); |
|
| 67 | } |
|
| 68 | ||
| 69 | if (!$schema->hasTable('circles_members')) { |
|
| 70 | $table = $schema->createTable('circles_members'); |
|
| @@ 69-100 (lines=32) @@ | ||
| 66 | $table->setPrimaryKey(['id']); |
|
| 67 | } |
|
| 68 | ||
| 69 | if (!$schema->hasTable('circles_members')) { |
|
| 70 | $table = $schema->createTable('circles_members'); |
|
| 71 | $table->addColumn('circle_id', 'string', [ |
|
| 72 | 'notnull' => true, |
|
| 73 | 'length' => 64, |
|
| 74 | ]); |
|
| 75 | $table->addColumn('user_id', 'string', [ |
|
| 76 | 'notnull' => true, |
|
| 77 | 'length' => 128, |
|
| 78 | ]); |
|
| 79 | $table->addColumn('user_type', 'smallint', [ |
|
| 80 | 'notnull' => true, |
|
| 81 | 'length' => 1, |
|
| 82 | 'default' => 1, |
|
| 83 | ]); |
|
| 84 | $table->addColumn('level', 'smallint', [ |
|
| 85 | 'notnull' => true, |
|
| 86 | 'length' => 1, |
|
| 87 | ]); |
|
| 88 | $table->addColumn('status', 'string', [ |
|
| 89 | 'notnull' => false, |
|
| 90 | 'length' => 15, |
|
| 91 | ]); |
|
| 92 | $table->addColumn('note', 'string', [ |
|
| 93 | 'notnull' => false, |
|
| 94 | 'length' => 255, |
|
| 95 | ]); |
|
| 96 | $table->addColumn('joined', 'datetime', [ |
|
| 97 | 'notnull' => false, |
|
| 98 | ]); |
|
| 99 | $table->setPrimaryKey(['circle_id', 'user_id']); |
|
| 100 | } |
|
| 101 | ||
| 102 | if (!$schema->hasTable('circles_groups')) { |
|
| 103 | $table = $schema->createTable('circles_groups'); |
|