@@ -35,31 +35,31 @@ |
||
| 35 | 35 | * Auto-generated migration step: Please modify to your needs! |
| 36 | 36 | */ |
| 37 | 37 | class Version22000Date20210216080825 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - */ |
|
| 44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | - /** @var ISchemaWrapper $schema */ |
|
| 46 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * @return null|ISchemaWrapper |
|
| 43 | + */ |
|
| 44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | + /** @var ISchemaWrapper $schema */ |
|
| 46 | + $schema = $schemaClosure(); |
|
| 47 | 47 | |
| 48 | - $table = $schema->getTable('appconfig'); |
|
| 49 | - if ($table->hasIndex('appconfig_appid_key')) { |
|
| 50 | - $table->dropIndex('appconfig_appid_key'); |
|
| 51 | - } |
|
| 48 | + $table = $schema->getTable('appconfig'); |
|
| 49 | + if ($table->hasIndex('appconfig_appid_key')) { |
|
| 50 | + $table->dropIndex('appconfig_appid_key'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $table = $schema->getTable('collres_accesscache'); |
|
| 54 | - if ($table->hasIndex('collres_user_coll')) { |
|
| 55 | - $table->dropIndex('collres_user_coll'); |
|
| 56 | - } |
|
| 53 | + $table = $schema->getTable('collres_accesscache'); |
|
| 54 | + if ($table->hasIndex('collres_user_coll')) { |
|
| 55 | + $table->dropIndex('collres_user_coll'); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - $table = $schema->getTable('mounts'); |
|
| 59 | - if ($table->hasIndex('mounts_user_index')) { |
|
| 60 | - $table->dropIndex('mounts_user_index'); |
|
| 61 | - } |
|
| 58 | + $table = $schema->getTable('mounts'); |
|
| 59 | + if ($table->hasIndex('mounts_user_index')) { |
|
| 60 | + $table->dropIndex('mounts_user_index'); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $schema; |
|
| 64 | - } |
|
| 63 | + return $schema; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -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' => 4096, |
|
| 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' => 4096, |
|
| 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' => 4096, |
|
| 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' => 4096, |
|
| 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 | } |
@@ -35,31 +35,31 @@ |
||
| 35 | 35 | * Auto-generated migration step: Please modify to your needs! |
| 36 | 36 | */ |
| 37 | 37 | class Version22000Date20210216084416 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - */ |
|
| 44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | - /** @var ISchemaWrapper $schema */ |
|
| 46 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * @return null|ISchemaWrapper |
|
| 43 | + */ |
|
| 44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | + /** @var ISchemaWrapper $schema */ |
|
| 46 | + $schema = $schemaClosure(); |
|
| 47 | 47 | |
| 48 | - $table = $schema->getTable('external_applicable'); |
|
| 49 | - if ($table->hasIndex('applicable_type_value')) { |
|
| 50 | - $table->dropIndex('applicable_type_value'); |
|
| 51 | - } |
|
| 48 | + $table = $schema->getTable('external_applicable'); |
|
| 49 | + if ($table->hasIndex('applicable_type_value')) { |
|
| 50 | + $table->dropIndex('applicable_type_value'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - $table = $schema->getTable('external_config'); |
|
| 54 | - if ($table->hasIndex('config_mount')) { |
|
| 55 | - $table->dropIndex('config_mount'); |
|
| 56 | - } |
|
| 53 | + $table = $schema->getTable('external_config'); |
|
| 54 | + if ($table->hasIndex('config_mount')) { |
|
| 55 | + $table->dropIndex('config_mount'); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - $table = $schema->getTable('external_options'); |
|
| 59 | - if ($table->hasIndex('option_mount')) { |
|
| 60 | - $table->dropIndex('option_mount'); |
|
| 61 | - } |
|
| 58 | + $table = $schema->getTable('external_options'); |
|
| 59 | + if ($table->hasIndex('option_mount')) { |
|
| 60 | + $table->dropIndex('option_mount'); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $schema; |
|
| 64 | - } |
|
| 63 | + return $schema; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -38,41 +38,41 @@ |
||
| 38 | 38 | * Auto-generated migration step: Please modify to your needs! |
| 39 | 39 | */ |
| 40 | 40 | class Version1011Date20190806104428 extends SimpleMigrationStep { |
| 41 | - /** |
|
| 42 | - * @param IOutput $output |
|
| 43 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 44 | - * @param array $options |
|
| 45 | - * @return null|ISchemaWrapper |
|
| 46 | - */ |
|
| 47 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 48 | - /** @var ISchemaWrapper $schema */ |
|
| 49 | - $schema = $schemaClosure(); |
|
| 41 | + /** |
|
| 42 | + * @param IOutput $output |
|
| 43 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 44 | + * @param array $options |
|
| 45 | + * @return null|ISchemaWrapper |
|
| 46 | + */ |
|
| 47 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 48 | + /** @var ISchemaWrapper $schema */ |
|
| 49 | + $schema = $schemaClosure(); |
|
| 50 | 50 | |
| 51 | - $table = $schema->createTable('dav_cal_proxy'); |
|
| 52 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | - 'autoincrement' => true, |
|
| 54 | - 'notnull' => true, |
|
| 55 | - 'length' => 11, |
|
| 56 | - 'unsigned' => true, |
|
| 57 | - ]); |
|
| 58 | - $table->addColumn('owner_id', Types::STRING, [ |
|
| 59 | - 'notnull' => true, |
|
| 60 | - 'length' => 64, |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('proxy_id', Types::STRING, [ |
|
| 63 | - 'notnull' => true, |
|
| 64 | - 'length' => 64, |
|
| 65 | - ]); |
|
| 66 | - $table->addColumn('permissions', Types::INTEGER, [ |
|
| 67 | - 'notnull' => false, |
|
| 68 | - 'length' => 4, |
|
| 69 | - 'unsigned' => true, |
|
| 70 | - ]); |
|
| 51 | + $table = $schema->createTable('dav_cal_proxy'); |
|
| 52 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 53 | + 'autoincrement' => true, |
|
| 54 | + 'notnull' => true, |
|
| 55 | + 'length' => 11, |
|
| 56 | + 'unsigned' => true, |
|
| 57 | + ]); |
|
| 58 | + $table->addColumn('owner_id', Types::STRING, [ |
|
| 59 | + 'notnull' => true, |
|
| 60 | + 'length' => 64, |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('proxy_id', Types::STRING, [ |
|
| 63 | + 'notnull' => true, |
|
| 64 | + 'length' => 64, |
|
| 65 | + ]); |
|
| 66 | + $table->addColumn('permissions', Types::INTEGER, [ |
|
| 67 | + 'notnull' => false, |
|
| 68 | + 'length' => 4, |
|
| 69 | + 'unsigned' => true, |
|
| 70 | + ]); |
|
| 71 | 71 | |
| 72 | - $table->setPrimaryKey(['id']); |
|
| 73 | - $table->addUniqueIndex(['owner_id', 'proxy_id', 'permissions'], 'dav_cal_proxy_uidx'); |
|
| 74 | - $table->addIndex(['proxy_id'], 'dav_cal_proxy_ipid'); |
|
| 72 | + $table->setPrimaryKey(['id']); |
|
| 73 | + $table->addUniqueIndex(['owner_id', 'proxy_id', 'permissions'], 'dav_cal_proxy_uidx'); |
|
| 74 | + $table->addIndex(['proxy_id'], 'dav_cal_proxy_ipid'); |
|
| 75 | 75 | |
| 76 | - return $schema; |
|
| 77 | - } |
|
| 76 | + return $schema; |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -35,21 +35,21 @@ |
||
| 35 | 35 | * Auto-generated migration step: Please modify to your needs! |
| 36 | 36 | */ |
| 37 | 37 | class Version1017Date20210216083742 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - */ |
|
| 44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | - /** @var ISchemaWrapper $schema */ |
|
| 46 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * @return null|ISchemaWrapper |
|
| 43 | + */ |
|
| 44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | + /** @var ISchemaWrapper $schema */ |
|
| 46 | + $schema = $schemaClosure(); |
|
| 47 | 47 | |
| 48 | - $table = $schema->getTable('dav_cal_proxy'); |
|
| 49 | - if ($table->hasIndex('dav_cal_proxy_ioid')) { |
|
| 50 | - $table->dropIndex('dav_cal_proxy_ioid'); |
|
| 51 | - } |
|
| 48 | + $table = $schema->getTable('dav_cal_proxy'); |
|
| 49 | + if ($table->hasIndex('dav_cal_proxy_ioid')) { |
|
| 50 | + $table->dropIndex('dav_cal_proxy_ioid'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return $schema; |
|
| 54 | - } |
|
| 53 | + return $schema; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -37,109 +37,109 @@ |
||
| 37 | 37 | |
| 38 | 38 | class Version11300Date20201120141438 extends SimpleMigrationStep { |
| 39 | 39 | |
| 40 | - /** @var IDBConnection */ |
|
| 41 | - private $connection; |
|
| 40 | + /** @var IDBConnection */ |
|
| 41 | + private $connection; |
|
| 42 | 42 | |
| 43 | - public function __construct(IDBConnection $connection) { |
|
| 44 | - $this->connection = $connection; |
|
| 45 | - } |
|
| 43 | + public function __construct(IDBConnection $connection) { |
|
| 44 | + $this->connection = $connection; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 48 | - /** @var ISchemaWrapper $schema */ |
|
| 49 | - $schema = $schemaClosure(); |
|
| 47 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 48 | + /** @var ISchemaWrapper $schema */ |
|
| 49 | + $schema = $schemaClosure(); |
|
| 50 | 50 | |
| 51 | - if (!$schema->hasTable('share_external')) { |
|
| 52 | - $table = $schema->createTable('share_external'); |
|
| 53 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 54 | - 'autoincrement' => true, |
|
| 55 | - 'notnull' => true, |
|
| 56 | - ]); |
|
| 57 | - $table->addColumn('parent', Types::BIGINT, [ |
|
| 58 | - 'notnull' => false, |
|
| 59 | - 'default' => -1, |
|
| 60 | - ]); |
|
| 61 | - $table->addColumn('share_type', Types::INTEGER, [ |
|
| 62 | - 'notnull' => false, |
|
| 63 | - 'length' => 4, |
|
| 64 | - ]); |
|
| 65 | - $table->addColumn('remote', Types::STRING, [ |
|
| 66 | - 'notnull' => true, |
|
| 67 | - 'length' => 512, |
|
| 68 | - ]); |
|
| 69 | - $table->addColumn('remote_id', Types::STRING, [ |
|
| 70 | - 'notnull' => false, |
|
| 71 | - 'length' => 255, |
|
| 72 | - 'default' => '', |
|
| 73 | - ]); |
|
| 74 | - $table->addColumn('share_token', Types::STRING, [ |
|
| 75 | - 'notnull' => true, |
|
| 76 | - 'length' => 64, |
|
| 77 | - ]); |
|
| 78 | - $table->addColumn('password', Types::STRING, [ |
|
| 79 | - 'notnull' => false, |
|
| 80 | - 'length' => 64, |
|
| 81 | - ]); |
|
| 82 | - $table->addColumn('name', Types::STRING, [ |
|
| 83 | - 'notnull' => true, |
|
| 84 | - 'length' => 64, |
|
| 85 | - ]); |
|
| 86 | - $table->addColumn('owner', Types::STRING, [ |
|
| 87 | - 'notnull' => true, |
|
| 88 | - 'length' => 64, |
|
| 89 | - ]); |
|
| 90 | - $table->addColumn('user', Types::STRING, [ |
|
| 91 | - 'notnull' => true, |
|
| 92 | - 'length' => 64, |
|
| 93 | - ]); |
|
| 94 | - $table->addColumn('mountpoint', Types::STRING, [ |
|
| 95 | - 'notnull' => true, |
|
| 96 | - 'length' => 4000, |
|
| 97 | - ]); |
|
| 98 | - $table->addColumn('mountpoint_hash', Types::STRING, [ |
|
| 99 | - 'notnull' => true, |
|
| 100 | - 'length' => 32, |
|
| 101 | - ]); |
|
| 102 | - $table->addColumn('accepted', Types::INTEGER, [ |
|
| 103 | - 'notnull' => true, |
|
| 104 | - 'length' => 4, |
|
| 105 | - 'default' => 0, |
|
| 106 | - ]); |
|
| 107 | - $table->setPrimaryKey(['id']); |
|
| 108 | - $table->addUniqueIndex(['user', 'mountpoint_hash'], 'sh_external_mp'); |
|
| 109 | - } else { |
|
| 110 | - $table = $schema->getTable('share_external'); |
|
| 111 | - $remoteIdColumn = $table->getColumn('remote_id'); |
|
| 112 | - if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) { |
|
| 113 | - $remoteIdColumn->setNotnull(false); |
|
| 114 | - $remoteIdColumn->setType(Type::getType(Types::STRING)); |
|
| 115 | - $remoteIdColumn->setOptions(['length' => 255]); |
|
| 116 | - $remoteIdColumn->setDefault(''); |
|
| 117 | - } |
|
| 118 | - if (!$table->hasColumn('parent')) { |
|
| 119 | - $table->addColumn('parent', Types::BIGINT, [ |
|
| 120 | - 'notnull' => false, |
|
| 121 | - 'default' => -1, |
|
| 122 | - ]); |
|
| 123 | - } |
|
| 124 | - if (!$table->hasColumn('share_type')) { |
|
| 125 | - $table->addColumn('share_type', Types::INTEGER, [ |
|
| 126 | - 'notnull' => false, |
|
| 127 | - 'length' => 4, |
|
| 128 | - ]); |
|
| 129 | - } |
|
| 130 | - if ($table->hasColumn('lastscan')) { |
|
| 131 | - $table->dropColumn('lastscan'); |
|
| 132 | - } |
|
| 133 | - } |
|
| 51 | + if (!$schema->hasTable('share_external')) { |
|
| 52 | + $table = $schema->createTable('share_external'); |
|
| 53 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 54 | + 'autoincrement' => true, |
|
| 55 | + 'notnull' => true, |
|
| 56 | + ]); |
|
| 57 | + $table->addColumn('parent', Types::BIGINT, [ |
|
| 58 | + 'notnull' => false, |
|
| 59 | + 'default' => -1, |
|
| 60 | + ]); |
|
| 61 | + $table->addColumn('share_type', Types::INTEGER, [ |
|
| 62 | + 'notnull' => false, |
|
| 63 | + 'length' => 4, |
|
| 64 | + ]); |
|
| 65 | + $table->addColumn('remote', Types::STRING, [ |
|
| 66 | + 'notnull' => true, |
|
| 67 | + 'length' => 512, |
|
| 68 | + ]); |
|
| 69 | + $table->addColumn('remote_id', Types::STRING, [ |
|
| 70 | + 'notnull' => false, |
|
| 71 | + 'length' => 255, |
|
| 72 | + 'default' => '', |
|
| 73 | + ]); |
|
| 74 | + $table->addColumn('share_token', Types::STRING, [ |
|
| 75 | + 'notnull' => true, |
|
| 76 | + 'length' => 64, |
|
| 77 | + ]); |
|
| 78 | + $table->addColumn('password', Types::STRING, [ |
|
| 79 | + 'notnull' => false, |
|
| 80 | + 'length' => 64, |
|
| 81 | + ]); |
|
| 82 | + $table->addColumn('name', Types::STRING, [ |
|
| 83 | + 'notnull' => true, |
|
| 84 | + 'length' => 64, |
|
| 85 | + ]); |
|
| 86 | + $table->addColumn('owner', Types::STRING, [ |
|
| 87 | + 'notnull' => true, |
|
| 88 | + 'length' => 64, |
|
| 89 | + ]); |
|
| 90 | + $table->addColumn('user', Types::STRING, [ |
|
| 91 | + 'notnull' => true, |
|
| 92 | + 'length' => 64, |
|
| 93 | + ]); |
|
| 94 | + $table->addColumn('mountpoint', Types::STRING, [ |
|
| 95 | + 'notnull' => true, |
|
| 96 | + 'length' => 4000, |
|
| 97 | + ]); |
|
| 98 | + $table->addColumn('mountpoint_hash', Types::STRING, [ |
|
| 99 | + 'notnull' => true, |
|
| 100 | + 'length' => 32, |
|
| 101 | + ]); |
|
| 102 | + $table->addColumn('accepted', Types::INTEGER, [ |
|
| 103 | + 'notnull' => true, |
|
| 104 | + 'length' => 4, |
|
| 105 | + 'default' => 0, |
|
| 106 | + ]); |
|
| 107 | + $table->setPrimaryKey(['id']); |
|
| 108 | + $table->addUniqueIndex(['user', 'mountpoint_hash'], 'sh_external_mp'); |
|
| 109 | + } else { |
|
| 110 | + $table = $schema->getTable('share_external'); |
|
| 111 | + $remoteIdColumn = $table->getColumn('remote_id'); |
|
| 112 | + if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) { |
|
| 113 | + $remoteIdColumn->setNotnull(false); |
|
| 114 | + $remoteIdColumn->setType(Type::getType(Types::STRING)); |
|
| 115 | + $remoteIdColumn->setOptions(['length' => 255]); |
|
| 116 | + $remoteIdColumn->setDefault(''); |
|
| 117 | + } |
|
| 118 | + if (!$table->hasColumn('parent')) { |
|
| 119 | + $table->addColumn('parent', Types::BIGINT, [ |
|
| 120 | + 'notnull' => false, |
|
| 121 | + 'default' => -1, |
|
| 122 | + ]); |
|
| 123 | + } |
|
| 124 | + if (!$table->hasColumn('share_type')) { |
|
| 125 | + $table->addColumn('share_type', Types::INTEGER, [ |
|
| 126 | + 'notnull' => false, |
|
| 127 | + 'length' => 4, |
|
| 128 | + ]); |
|
| 129 | + } |
|
| 130 | + if ($table->hasColumn('lastscan')) { |
|
| 131 | + $table->dropColumn('lastscan'); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - return $schema; |
|
| 136 | - } |
|
| 135 | + return $schema; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 139 | - $qb = $this->connection->getQueryBuilder(); |
|
| 140 | - $qb->update('share_external') |
|
| 141 | - ->set('remote_id', $qb->createNamedParameter('')) |
|
| 142 | - ->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1'))); |
|
| 143 | - $qb->execute(); |
|
| 144 | - } |
|
| 138 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 139 | + $qb = $this->connection->getQueryBuilder(); |
|
| 140 | + $qb->update('share_external') |
|
| 141 | + ->set('remote_id', $qb->createNamedParameter('')) |
|
| 142 | + ->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1'))); |
|
| 143 | + $qb->execute(); |
|
| 144 | + } |
|
| 145 | 145 | } |
@@ -35,21 +35,21 @@ |
||
| 35 | 35 | * Auto-generated migration step: Please modify to your needs! |
| 36 | 36 | */ |
| 37 | 37 | class Version22000Date20210216084241 extends SimpleMigrationStep { |
| 38 | - /** |
|
| 39 | - * @param IOutput $output |
|
| 40 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | - * @param array $options |
|
| 42 | - * @return null|ISchemaWrapper |
|
| 43 | - */ |
|
| 44 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | - /** @var ISchemaWrapper $schema */ |
|
| 46 | - $schema = $schemaClosure(); |
|
| 38 | + /** |
|
| 39 | + * @param IOutput $output |
|
| 40 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 41 | + * @param array $options |
|
| 42 | + * @return null|ISchemaWrapper |
|
| 43 | + */ |
|
| 44 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 45 | + /** @var ISchemaWrapper $schema */ |
|
| 46 | + $schema = $schemaClosure(); |
|
| 47 | 47 | |
| 48 | - $table = $schema->getTable('share_external'); |
|
| 49 | - if ($table->hasIndex('sh_external_user')) { |
|
| 50 | - $table->dropIndex('sh_external_user'); |
|
| 51 | - } |
|
| 48 | + $table = $schema->getTable('share_external'); |
|
| 49 | + if ($table->hasIndex('sh_external_user')) { |
|
| 50 | + $table->dropIndex('sh_external_user'); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return $schema; |
|
| 54 | - } |
|
| 53 | + return $schema; |
|
| 54 | + } |
|
| 55 | 55 | } |