@@ -34,122 +34,122 @@ |
||
| 34 | 34 | use OCP\Migration\SimpleMigrationStep; |
| 35 | 35 | |
| 36 | 36 | class Version1011Date20200630192246 extends SimpleMigrationStep { |
| 37 | - /** |
|
| 38 | - * @param IOutput $output |
|
| 39 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 40 | - * @param array $options |
|
| 41 | - * @return null|ISchemaWrapper |
|
| 42 | - */ |
|
| 43 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 44 | - /** @var ISchemaWrapper $schema */ |
|
| 45 | - $schema = $schemaClosure(); |
|
| 37 | + /** |
|
| 38 | + * @param IOutput $output |
|
| 39 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 40 | + * @param array $options |
|
| 41 | + * @return null|ISchemaWrapper |
|
| 42 | + */ |
|
| 43 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 44 | + /** @var ISchemaWrapper $schema */ |
|
| 45 | + $schema = $schemaClosure(); |
|
| 46 | 46 | |
| 47 | - if (!$schema->hasTable('external_mounts')) { |
|
| 48 | - $table = $schema->createTable('external_mounts'); |
|
| 49 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 50 | - 'autoincrement' => true, |
|
| 51 | - 'notnull' => true, |
|
| 52 | - 'length' => 6, |
|
| 53 | - ]); |
|
| 54 | - $table->addColumn('mount_point', Types::STRING, [ |
|
| 55 | - 'notnull' => true, |
|
| 56 | - 'length' => 128, |
|
| 57 | - ]); |
|
| 58 | - $table->addColumn('storage_backend', Types::STRING, [ |
|
| 59 | - 'notnull' => true, |
|
| 60 | - 'length' => 64, |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('auth_backend', Types::STRING, [ |
|
| 63 | - 'notnull' => true, |
|
| 64 | - 'length' => 64, |
|
| 65 | - ]); |
|
| 66 | - $table->addColumn('priority', Types::INTEGER, [ |
|
| 67 | - 'notnull' => true, |
|
| 68 | - 'length' => 4, |
|
| 69 | - 'default' => 100, |
|
| 70 | - ]); |
|
| 71 | - $table->addColumn('type', Types::INTEGER, [ |
|
| 72 | - 'notnull' => true, |
|
| 73 | - 'length' => 4, |
|
| 74 | - ]); |
|
| 75 | - $table->setPrimaryKey(['mount_id']); |
|
| 76 | - } |
|
| 47 | + if (!$schema->hasTable('external_mounts')) { |
|
| 48 | + $table = $schema->createTable('external_mounts'); |
|
| 49 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 50 | + 'autoincrement' => true, |
|
| 51 | + 'notnull' => true, |
|
| 52 | + 'length' => 6, |
|
| 53 | + ]); |
|
| 54 | + $table->addColumn('mount_point', Types::STRING, [ |
|
| 55 | + 'notnull' => true, |
|
| 56 | + 'length' => 128, |
|
| 57 | + ]); |
|
| 58 | + $table->addColumn('storage_backend', Types::STRING, [ |
|
| 59 | + 'notnull' => true, |
|
| 60 | + 'length' => 64, |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('auth_backend', Types::STRING, [ |
|
| 63 | + 'notnull' => true, |
|
| 64 | + 'length' => 64, |
|
| 65 | + ]); |
|
| 66 | + $table->addColumn('priority', Types::INTEGER, [ |
|
| 67 | + 'notnull' => true, |
|
| 68 | + 'length' => 4, |
|
| 69 | + 'default' => 100, |
|
| 70 | + ]); |
|
| 71 | + $table->addColumn('type', Types::INTEGER, [ |
|
| 72 | + 'notnull' => true, |
|
| 73 | + 'length' => 4, |
|
| 74 | + ]); |
|
| 75 | + $table->setPrimaryKey(['mount_id']); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - if (!$schema->hasTable('external_applicable')) { |
|
| 79 | - $table = $schema->createTable('external_applicable'); |
|
| 80 | - $table->addColumn('applicable_id', Types::BIGINT, [ |
|
| 81 | - 'autoincrement' => true, |
|
| 82 | - 'notnull' => true, |
|
| 83 | - 'length' => 6, |
|
| 84 | - ]); |
|
| 85 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 86 | - 'notnull' => true, |
|
| 87 | - 'length' => 6, |
|
| 88 | - ]); |
|
| 89 | - $table->addColumn('type', Types::INTEGER, [ |
|
| 90 | - 'notnull' => true, |
|
| 91 | - 'length' => 4, |
|
| 92 | - ]); |
|
| 93 | - $table->addColumn('value', Types::STRING, [ |
|
| 94 | - 'notnull' => false, |
|
| 95 | - 'length' => 64, |
|
| 96 | - ]); |
|
| 97 | - $table->setPrimaryKey(['applicable_id']); |
|
| 98 | - $table->addIndex(['mount_id'], 'applicable_mount'); |
|
| 99 | - $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
| 100 | - } |
|
| 78 | + if (!$schema->hasTable('external_applicable')) { |
|
| 79 | + $table = $schema->createTable('external_applicable'); |
|
| 80 | + $table->addColumn('applicable_id', Types::BIGINT, [ |
|
| 81 | + 'autoincrement' => true, |
|
| 82 | + 'notnull' => true, |
|
| 83 | + 'length' => 6, |
|
| 84 | + ]); |
|
| 85 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 86 | + 'notnull' => true, |
|
| 87 | + 'length' => 6, |
|
| 88 | + ]); |
|
| 89 | + $table->addColumn('type', Types::INTEGER, [ |
|
| 90 | + 'notnull' => true, |
|
| 91 | + 'length' => 4, |
|
| 92 | + ]); |
|
| 93 | + $table->addColumn('value', Types::STRING, [ |
|
| 94 | + 'notnull' => false, |
|
| 95 | + 'length' => 64, |
|
| 96 | + ]); |
|
| 97 | + $table->setPrimaryKey(['applicable_id']); |
|
| 98 | + $table->addIndex(['mount_id'], 'applicable_mount'); |
|
| 99 | + $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - if (!$schema->hasTable('external_config')) { |
|
| 103 | - $table = $schema->createTable('external_config'); |
|
| 104 | - $table->addColumn('config_id', Types::BIGINT, [ |
|
| 105 | - 'autoincrement' => true, |
|
| 106 | - 'notnull' => true, |
|
| 107 | - 'length' => 6, |
|
| 108 | - ]); |
|
| 109 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 110 | - 'notnull' => true, |
|
| 111 | - 'length' => 6, |
|
| 112 | - ]); |
|
| 113 | - $table->addColumn('key', Types::STRING, [ |
|
| 114 | - 'notnull' => true, |
|
| 115 | - 'length' => 64, |
|
| 116 | - ]); |
|
| 117 | - $table->addColumn('value', Types::STRING, [ |
|
| 118 | - 'notnull' => false, |
|
| 119 | - 'length' => 4000, |
|
| 120 | - ]); |
|
| 121 | - $table->setPrimaryKey(['config_id']); |
|
| 122 | - $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
| 123 | - } else { |
|
| 124 | - $table = $schema->getTable('external_config'); |
|
| 125 | - $table->changeColumn('value', [ |
|
| 126 | - 'notnull' => false, |
|
| 127 | - 'length' => 4000, |
|
| 128 | - ]); |
|
| 129 | - } |
|
| 102 | + if (!$schema->hasTable('external_config')) { |
|
| 103 | + $table = $schema->createTable('external_config'); |
|
| 104 | + $table->addColumn('config_id', Types::BIGINT, [ |
|
| 105 | + 'autoincrement' => true, |
|
| 106 | + 'notnull' => true, |
|
| 107 | + 'length' => 6, |
|
| 108 | + ]); |
|
| 109 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 110 | + 'notnull' => true, |
|
| 111 | + 'length' => 6, |
|
| 112 | + ]); |
|
| 113 | + $table->addColumn('key', Types::STRING, [ |
|
| 114 | + 'notnull' => true, |
|
| 115 | + 'length' => 64, |
|
| 116 | + ]); |
|
| 117 | + $table->addColumn('value', Types::STRING, [ |
|
| 118 | + 'notnull' => false, |
|
| 119 | + 'length' => 4000, |
|
| 120 | + ]); |
|
| 121 | + $table->setPrimaryKey(['config_id']); |
|
| 122 | + $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
| 123 | + } else { |
|
| 124 | + $table = $schema->getTable('external_config'); |
|
| 125 | + $table->changeColumn('value', [ |
|
| 126 | + 'notnull' => false, |
|
| 127 | + 'length' => 4000, |
|
| 128 | + ]); |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - if (!$schema->hasTable('external_options')) { |
|
| 132 | - $table = $schema->createTable('external_options'); |
|
| 133 | - $table->addColumn('option_id', Types::BIGINT, [ |
|
| 134 | - 'autoincrement' => true, |
|
| 135 | - 'notnull' => true, |
|
| 136 | - 'length' => 6, |
|
| 137 | - ]); |
|
| 138 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 139 | - 'notnull' => true, |
|
| 140 | - 'length' => 6, |
|
| 141 | - ]); |
|
| 142 | - $table->addColumn('key', Types::STRING, [ |
|
| 143 | - 'notnull' => true, |
|
| 144 | - 'length' => 64, |
|
| 145 | - ]); |
|
| 146 | - $table->addColumn('value', Types::STRING, [ |
|
| 147 | - 'notnull' => true, |
|
| 148 | - 'length' => 256, |
|
| 149 | - ]); |
|
| 150 | - $table->setPrimaryKey(['option_id']); |
|
| 151 | - $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
| 152 | - } |
|
| 153 | - return $schema; |
|
| 154 | - } |
|
| 131 | + if (!$schema->hasTable('external_options')) { |
|
| 132 | + $table = $schema->createTable('external_options'); |
|
| 133 | + $table->addColumn('option_id', Types::BIGINT, [ |
|
| 134 | + 'autoincrement' => true, |
|
| 135 | + 'notnull' => true, |
|
| 136 | + 'length' => 6, |
|
| 137 | + ]); |
|
| 138 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 139 | + 'notnull' => true, |
|
| 140 | + 'length' => 6, |
|
| 141 | + ]); |
|
| 142 | + $table->addColumn('key', Types::STRING, [ |
|
| 143 | + 'notnull' => true, |
|
| 144 | + 'length' => 64, |
|
| 145 | + ]); |
|
| 146 | + $table->addColumn('value', Types::STRING, [ |
|
| 147 | + 'notnull' => true, |
|
| 148 | + 'length' => 256, |
|
| 149 | + ]); |
|
| 150 | + $table->setPrimaryKey(['option_id']); |
|
| 151 | + $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
| 152 | + } |
|
| 153 | + return $schema; |
|
| 154 | + } |
|
| 155 | 155 | } |