@@ -34,30 +34,30 @@ |
||
| 34 | 34 | |
| 35 | 35 | class Version18000Date20191204114856 extends SimpleMigrationStep { |
| 36 | 36 | |
| 37 | - /** @var IDBConnection */ |
|
| 38 | - protected $connection; |
|
| 39 | - |
|
| 40 | - public function __construct(IDBConnection $connection) { |
|
| 41 | - $this->connection = $connection; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param IOutput $output |
|
| 46 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 47 | - * @param array $options |
|
| 48 | - * @return null|ISchemaWrapper |
|
| 49 | - * @throws \Doctrine\DBAL\Schema\SchemaException |
|
| 50 | - */ |
|
| 51 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 52 | - /** @var ISchemaWrapper $schema */ |
|
| 53 | - $schema = $schemaClosure(); |
|
| 54 | - $table = $schema->getTable('direct_edit'); |
|
| 55 | - |
|
| 56 | - $table->addColumn('file_path', 'string', [ |
|
| 57 | - 'notnull' => false, |
|
| 58 | - 'length' => 4000, |
|
| 59 | - ]); |
|
| 60 | - |
|
| 61 | - return $schema; |
|
| 62 | - } |
|
| 37 | + /** @var IDBConnection */ |
|
| 38 | + protected $connection; |
|
| 39 | + |
|
| 40 | + public function __construct(IDBConnection $connection) { |
|
| 41 | + $this->connection = $connection; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param IOutput $output |
|
| 46 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 47 | + * @param array $options |
|
| 48 | + * @return null|ISchemaWrapper |
|
| 49 | + * @throws \Doctrine\DBAL\Schema\SchemaException |
|
| 50 | + */ |
|
| 51 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 52 | + /** @var ISchemaWrapper $schema */ |
|
| 53 | + $schema = $schemaClosure(); |
|
| 54 | + $table = $schema->getTable('direct_edit'); |
|
| 55 | + |
|
| 56 | + $table->addColumn('file_path', 'string', [ |
|
| 57 | + 'notnull' => false, |
|
| 58 | + 'length' => 4000, |
|
| 59 | + ]); |
|
| 60 | + |
|
| 61 | + return $schema; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -37,82 +37,82 @@ |
||
| 37 | 37 | class Version16000Date20190207141427 extends SimpleMigrationStep { |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @param IOutput $output |
|
| 42 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 43 | - * @param array $options |
|
| 44 | - * @return null|ISchemaWrapper |
|
| 45 | - */ |
|
| 46 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 47 | - /** @var ISchemaWrapper $schema */ |
|
| 48 | - $schema = $schemaClosure(); |
|
| 49 | - |
|
| 50 | - if (!$schema->hasTable('collres_collections')) { |
|
| 51 | - $table = $schema->createTable('collres_collections'); |
|
| 52 | - |
|
| 53 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 54 | - 'autoincrement' => true, |
|
| 55 | - 'notnull' => true, |
|
| 56 | - ]); |
|
| 57 | - $table->addColumn('name', Types::STRING, [ |
|
| 58 | - 'notnull' => true, |
|
| 59 | - 'length' => 64, |
|
| 60 | - ]); |
|
| 61 | - |
|
| 62 | - $table->setPrimaryKey(['id']); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - if (!$schema->hasTable('collres_resources')) { |
|
| 66 | - $table = $schema->createTable('collres_resources'); |
|
| 67 | - |
|
| 68 | - $table->addColumn('collection_id', Types::BIGINT, [ |
|
| 69 | - 'notnull' => true, |
|
| 70 | - ]); |
|
| 71 | - $table->addColumn('resource_type', Types::STRING, [ |
|
| 72 | - 'notnull' => true, |
|
| 73 | - 'length' => 64, |
|
| 74 | - ]); |
|
| 75 | - $table->addColumn('resource_id', Types::STRING, [ |
|
| 76 | - 'notnull' => true, |
|
| 77 | - 'length' => 64, |
|
| 78 | - ]); |
|
| 79 | - |
|
| 80 | - $table->setPrimaryKey(['collection_id', 'resource_type', 'resource_id'], 'crr_pk'); |
|
| 40 | + /** |
|
| 41 | + * @param IOutput $output |
|
| 42 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 43 | + * @param array $options |
|
| 44 | + * @return null|ISchemaWrapper |
|
| 45 | + */ |
|
| 46 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 47 | + /** @var ISchemaWrapper $schema */ |
|
| 48 | + $schema = $schemaClosure(); |
|
| 49 | + |
|
| 50 | + if (!$schema->hasTable('collres_collections')) { |
|
| 51 | + $table = $schema->createTable('collres_collections'); |
|
| 52 | + |
|
| 53 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 54 | + 'autoincrement' => true, |
|
| 55 | + 'notnull' => true, |
|
| 56 | + ]); |
|
| 57 | + $table->addColumn('name', Types::STRING, [ |
|
| 58 | + 'notnull' => true, |
|
| 59 | + 'length' => 64, |
|
| 60 | + ]); |
|
| 61 | + |
|
| 62 | + $table->setPrimaryKey(['id']); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + if (!$schema->hasTable('collres_resources')) { |
|
| 66 | + $table = $schema->createTable('collres_resources'); |
|
| 67 | + |
|
| 68 | + $table->addColumn('collection_id', Types::BIGINT, [ |
|
| 69 | + 'notnull' => true, |
|
| 70 | + ]); |
|
| 71 | + $table->addColumn('resource_type', Types::STRING, [ |
|
| 72 | + 'notnull' => true, |
|
| 73 | + 'length' => 64, |
|
| 74 | + ]); |
|
| 75 | + $table->addColumn('resource_id', Types::STRING, [ |
|
| 76 | + 'notnull' => true, |
|
| 77 | + 'length' => 64, |
|
| 78 | + ]); |
|
| 79 | + |
|
| 80 | + $table->setPrimaryKey(['collection_id', 'resource_type', 'resource_id'], 'crr_pk'); |
|
| 81 | 81 | // $table->addUniqueIndex(['collection_id', 'resource_type', 'resource_id'], 'collres_unique_res'); |
| 82 | - } |
|
| 83 | - |
|
| 84 | - if (!$schema->hasTable('collres_accesscache')) { |
|
| 85 | - $table = $schema->createTable('collres_accesscache'); |
|
| 86 | - |
|
| 87 | - $table->addColumn('user_id', Types::STRING, [ |
|
| 88 | - 'notnull' => true, |
|
| 89 | - 'length' => 64, |
|
| 90 | - ]); |
|
| 91 | - $table->addColumn('collection_id', Types::BIGINT, [ |
|
| 92 | - 'notnull' => false, |
|
| 93 | - 'default' => 0, |
|
| 94 | - ]); |
|
| 95 | - $table->addColumn('resource_type', Types::STRING, [ |
|
| 96 | - 'notnull' => false, |
|
| 97 | - 'length' => 64, |
|
| 98 | - 'default' => '', |
|
| 99 | - ]); |
|
| 100 | - $table->addColumn('resource_id', Types::STRING, [ |
|
| 101 | - 'notnull' => false, |
|
| 102 | - 'length' => 64, |
|
| 103 | - 'default' => '', |
|
| 104 | - ]); |
|
| 105 | - $table->addColumn('access', Types::SMALLINT, [ |
|
| 106 | - 'notnull' => false, |
|
| 107 | - 'default' => 0, |
|
| 108 | - ]); |
|
| 109 | - |
|
| 110 | - $table->setPrimaryKey(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'cra_pk'); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if (!$schema->hasTable('collres_accesscache')) { |
|
| 85 | + $table = $schema->createTable('collres_accesscache'); |
|
| 86 | + |
|
| 87 | + $table->addColumn('user_id', Types::STRING, [ |
|
| 88 | + 'notnull' => true, |
|
| 89 | + 'length' => 64, |
|
| 90 | + ]); |
|
| 91 | + $table->addColumn('collection_id', Types::BIGINT, [ |
|
| 92 | + 'notnull' => false, |
|
| 93 | + 'default' => 0, |
|
| 94 | + ]); |
|
| 95 | + $table->addColumn('resource_type', Types::STRING, [ |
|
| 96 | + 'notnull' => false, |
|
| 97 | + 'length' => 64, |
|
| 98 | + 'default' => '', |
|
| 99 | + ]); |
|
| 100 | + $table->addColumn('resource_id', Types::STRING, [ |
|
| 101 | + 'notnull' => false, |
|
| 102 | + 'length' => 64, |
|
| 103 | + 'default' => '', |
|
| 104 | + ]); |
|
| 105 | + $table->addColumn('access', Types::SMALLINT, [ |
|
| 106 | + 'notnull' => false, |
|
| 107 | + 'default' => 0, |
|
| 108 | + ]); |
|
| 109 | + |
|
| 110 | + $table->setPrimaryKey(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'cra_pk'); |
|
| 111 | 111 | // $table->addUniqueIndex(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'collres_unique_user'); |
| 112 | - $table->addIndex(['user_id', 'resource_type', 'resource_id'], 'collres_user_res'); |
|
| 113 | - $table->addIndex(['user_id', 'collection_id'], 'collres_user_coll'); |
|
| 114 | - } |
|
| 112 | + $table->addIndex(['user_id', 'resource_type', 'resource_id'], 'collres_user_res'); |
|
| 113 | + $table->addIndex(['user_id', 'collection_id'], 'collres_user_coll'); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - return $schema; |
|
| 117 | - } |
|
| 116 | + return $schema; |
|
| 117 | + } |
|
| 118 | 118 | } |
@@ -33,22 +33,22 @@ |
||
| 33 | 33 | |
| 34 | 34 | class Version15000Date20180926101451 extends SimpleMigrationStep { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - */ |
|
| 42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | - /** @var ISchemaWrapper $schema */ |
|
| 44 | - $schema = $schemaClosure(); |
|
| 45 | - |
|
| 46 | - $table = $schema->getTable('authtoken'); |
|
| 47 | - $table->addColumn('password_invalid','boolean', [ |
|
| 48 | - 'default' => 0, |
|
| 49 | - 'notnull' => false, |
|
| 50 | - ]); |
|
| 51 | - |
|
| 52 | - return $schema; |
|
| 53 | - } |
|
| 36 | + /** |
|
| 37 | + * @param IOutput $output |
|
| 38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | + * @param array $options |
|
| 40 | + * @return null|ISchemaWrapper |
|
| 41 | + */ |
|
| 42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | + /** @var ISchemaWrapper $schema */ |
|
| 44 | + $schema = $schemaClosure(); |
|
| 45 | + |
|
| 46 | + $table = $schema->getTable('authtoken'); |
|
| 47 | + $table->addColumn('password_invalid','boolean', [ |
|
| 48 | + 'default' => 0, |
|
| 49 | + 'notnull' => false, |
|
| 50 | + ]); |
|
| 51 | + |
|
| 52 | + return $schema; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $schema = $schemaClosure(); |
| 45 | 45 | |
| 46 | 46 | $table = $schema->getTable('authtoken'); |
| 47 | - $table->addColumn('password_invalid','boolean', [ |
|
| 47 | + $table->addColumn('password_invalid', 'boolean', [ |
|
| 48 | 48 | 'default' => 0, |
| 49 | 49 | 'notnull' => false, |
| 50 | 50 | ]); |
@@ -36,782 +36,782 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | class Version13000Date20170718121200 extends SimpleMigrationStep { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param IOutput $output |
|
| 41 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 42 | - * @param array $options |
|
| 43 | - * @return null|ISchemaWrapper |
|
| 44 | - * @since 13.0.0 |
|
| 45 | - */ |
|
| 46 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 47 | - /** @var ISchemaWrapper $schema */ |
|
| 48 | - $schema = $schemaClosure(); |
|
| 49 | - |
|
| 50 | - if (!$schema->hasTable('appconfig')) { |
|
| 51 | - $table = $schema->createTable('appconfig'); |
|
| 52 | - $table->addColumn('appid', 'string', [ |
|
| 53 | - 'notnull' => true, |
|
| 54 | - 'length' => 32, |
|
| 55 | - 'default' => '', |
|
| 56 | - ]); |
|
| 57 | - $table->addColumn('configkey', 'string', [ |
|
| 58 | - 'notnull' => true, |
|
| 59 | - 'length' => 64, |
|
| 60 | - 'default' => '', |
|
| 61 | - ]); |
|
| 62 | - $table->addColumn('configvalue', 'text', [ |
|
| 63 | - 'notnull' => false, |
|
| 64 | - ]); |
|
| 65 | - $table->setPrimaryKey(['appid', 'configkey']); |
|
| 66 | - $table->addIndex(['configkey'], 'appconfig_config_key_index'); |
|
| 67 | - $table->addIndex(['appid'], 'appconfig_appid_key'); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (!$schema->hasTable('storages')) { |
|
| 71 | - $table = $schema->createTable('storages'); |
|
| 72 | - $table->addColumn('id', 'string', [ |
|
| 73 | - 'notnull' => false, |
|
| 74 | - 'length' => 64, |
|
| 75 | - ]); |
|
| 76 | - $table->addColumn('numeric_id', Types::BIGINT, [ |
|
| 77 | - 'autoincrement' => true, |
|
| 78 | - 'notnull' => true, |
|
| 79 | - 'length' => 20, |
|
| 80 | - ]); |
|
| 81 | - $table->addColumn('available', 'integer', [ |
|
| 82 | - 'notnull' => true, |
|
| 83 | - 'default' => 1, |
|
| 84 | - ]); |
|
| 85 | - $table->addColumn('last_checked', 'integer', [ |
|
| 86 | - 'notnull' => false, |
|
| 87 | - ]); |
|
| 88 | - $table->setPrimaryKey(['numeric_id']); |
|
| 89 | - $table->addUniqueIndex(['id'], 'storages_id_index'); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if (!$schema->hasTable('mounts')) { |
|
| 93 | - $table = $schema->createTable('mounts'); |
|
| 94 | - $table->addColumn('id', 'integer', [ |
|
| 95 | - 'autoincrement' => true, |
|
| 96 | - 'notnull' => true, |
|
| 97 | - 'length' => 4, |
|
| 98 | - ]); |
|
| 99 | - $table->addColumn('storage_id', Types::BIGINT, [ |
|
| 100 | - 'notnull' => true, |
|
| 101 | - 'length' => 20, |
|
| 102 | - ]); |
|
| 103 | - $table->addColumn('root_id', Types::BIGINT, [ |
|
| 104 | - 'notnull' => true, |
|
| 105 | - 'length' => 20, |
|
| 106 | - ]); |
|
| 107 | - $table->addColumn('user_id', 'string', [ |
|
| 108 | - 'notnull' => true, |
|
| 109 | - 'length' => 64, |
|
| 110 | - ]); |
|
| 111 | - $table->addColumn('mount_point', 'string', [ |
|
| 112 | - 'notnull' => true, |
|
| 113 | - 'length' => 4000, |
|
| 114 | - ]); |
|
| 115 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 116 | - 'notnull' => false, |
|
| 117 | - 'length' => 20, |
|
| 118 | - ]); |
|
| 119 | - $table->setPrimaryKey(['id']); |
|
| 120 | - $table->addIndex(['user_id'], 'mounts_user_index'); |
|
| 121 | - $table->addIndex(['storage_id'], 'mounts_storage_index'); |
|
| 122 | - $table->addIndex(['root_id'], 'mounts_root_index'); |
|
| 123 | - $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
| 124 | - $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - if (!$schema->hasTable('mimetypes')) { |
|
| 128 | - $table = $schema->createTable('mimetypes'); |
|
| 129 | - $table->addColumn('id', Types::BIGINT, [ |
|
| 130 | - 'autoincrement' => true, |
|
| 131 | - 'notnull' => true, |
|
| 132 | - 'length' => 20, |
|
| 133 | - ]); |
|
| 134 | - $table->addColumn('mimetype', 'string', [ |
|
| 135 | - 'notnull' => true, |
|
| 136 | - 'length' => 255, |
|
| 137 | - 'default' => '', |
|
| 138 | - ]); |
|
| 139 | - $table->setPrimaryKey(['id']); |
|
| 140 | - $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if (!$schema->hasTable('filecache')) { |
|
| 144 | - $table = $schema->createTable('filecache'); |
|
| 145 | - $table->addColumn('fileid', Types::BIGINT, [ |
|
| 146 | - 'autoincrement' => true, |
|
| 147 | - 'notnull' => true, |
|
| 148 | - 'length' => 20, |
|
| 149 | - ]); |
|
| 150 | - $table->addColumn('storage', Types::BIGINT, [ |
|
| 151 | - 'notnull' => true, |
|
| 152 | - 'length' => 20, |
|
| 153 | - 'default' => 0, |
|
| 154 | - ]); |
|
| 155 | - $table->addColumn('path', 'string', [ |
|
| 156 | - 'notnull' => false, |
|
| 157 | - 'length' => 4000, |
|
| 158 | - ]); |
|
| 159 | - $table->addColumn('path_hash', 'string', [ |
|
| 160 | - 'notnull' => true, |
|
| 161 | - 'length' => 32, |
|
| 162 | - 'default' => '', |
|
| 163 | - ]); |
|
| 164 | - $table->addColumn('parent', Types::BIGINT, [ |
|
| 165 | - 'notnull' => true, |
|
| 166 | - 'length' => 20, |
|
| 167 | - 'default' => 0, |
|
| 168 | - ]); |
|
| 169 | - $table->addColumn('name', 'string', [ |
|
| 170 | - 'notnull' => false, |
|
| 171 | - 'length' => 250, |
|
| 172 | - ]); |
|
| 173 | - $table->addColumn('mimetype', Types::BIGINT, [ |
|
| 174 | - 'notnull' => true, |
|
| 175 | - 'length' => 20, |
|
| 176 | - 'default' => 0, |
|
| 177 | - ]); |
|
| 178 | - $table->addColumn('mimepart', Types::BIGINT, [ |
|
| 179 | - 'notnull' => true, |
|
| 180 | - 'length' => 20, |
|
| 181 | - 'default' => 0, |
|
| 182 | - ]); |
|
| 183 | - $table->addColumn('size', 'bigint', [ |
|
| 184 | - 'notnull' => true, |
|
| 185 | - 'length' => 8, |
|
| 186 | - 'default' => 0, |
|
| 187 | - ]); |
|
| 188 | - $table->addColumn('mtime', Types::BIGINT, [ |
|
| 189 | - 'notnull' => true, |
|
| 190 | - 'length' => 20, |
|
| 191 | - 'default' => 0, |
|
| 192 | - ]); |
|
| 193 | - $table->addColumn('storage_mtime', Types::BIGINT, [ |
|
| 194 | - 'notnull' => true, |
|
| 195 | - 'length' => 20, |
|
| 196 | - 'default' => 0, |
|
| 197 | - ]); |
|
| 198 | - $table->addColumn('encrypted', 'integer', [ |
|
| 199 | - 'notnull' => true, |
|
| 200 | - 'length' => 4, |
|
| 201 | - 'default' => 0, |
|
| 202 | - ]); |
|
| 203 | - $table->addColumn('unencrypted_size', 'bigint', [ |
|
| 204 | - 'notnull' => true, |
|
| 205 | - 'length' => 8, |
|
| 206 | - 'default' => 0, |
|
| 207 | - ]); |
|
| 208 | - $table->addColumn('etag', 'string', [ |
|
| 209 | - 'notnull' => false, |
|
| 210 | - 'length' => 40, |
|
| 211 | - ]); |
|
| 212 | - $table->addColumn('permissions', 'integer', [ |
|
| 213 | - 'notnull' => false, |
|
| 214 | - 'length' => 4, |
|
| 215 | - 'default' => 0, |
|
| 216 | - ]); |
|
| 217 | - $table->addColumn('checksum', 'string', [ |
|
| 218 | - 'notnull' => false, |
|
| 219 | - 'length' => 255, |
|
| 220 | - ]); |
|
| 221 | - $table->setPrimaryKey(['fileid']); |
|
| 222 | - $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); |
|
| 223 | - $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); |
|
| 224 | - $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); |
|
| 225 | - $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); |
|
| 226 | - $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); |
|
| 227 | - $table->addIndex(['mtime'], 'fs_mtime'); |
|
| 228 | - $table->addIndex(['size'], 'fs_size'); |
|
| 229 | - } |
|
| 230 | - |
|
| 231 | - if (!$schema->hasTable('group_user')) { |
|
| 232 | - $table = $schema->createTable('group_user'); |
|
| 233 | - $table->addColumn('gid', 'string', [ |
|
| 234 | - 'notnull' => true, |
|
| 235 | - 'length' => 64, |
|
| 236 | - 'default' => '', |
|
| 237 | - ]); |
|
| 238 | - $table->addColumn('uid', 'string', [ |
|
| 239 | - 'notnull' => true, |
|
| 240 | - 'length' => 64, |
|
| 241 | - 'default' => '', |
|
| 242 | - ]); |
|
| 243 | - $table->setPrimaryKey(['gid', 'uid']); |
|
| 244 | - $table->addIndex(['uid'], 'gu_uid_index'); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - if (!$schema->hasTable('group_admin')) { |
|
| 248 | - $table = $schema->createTable('group_admin'); |
|
| 249 | - $table->addColumn('gid', 'string', [ |
|
| 250 | - 'notnull' => true, |
|
| 251 | - 'length' => 64, |
|
| 252 | - 'default' => '', |
|
| 253 | - ]); |
|
| 254 | - $table->addColumn('uid', 'string', [ |
|
| 255 | - 'notnull' => true, |
|
| 256 | - 'length' => 64, |
|
| 257 | - 'default' => '', |
|
| 258 | - ]); |
|
| 259 | - $table->setPrimaryKey(['gid', 'uid']); |
|
| 260 | - $table->addIndex(['uid'], 'group_admin_uid'); |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - if (!$schema->hasTable('groups')) { |
|
| 264 | - $table = $schema->createTable('groups'); |
|
| 265 | - $table->addColumn('gid', 'string', [ |
|
| 266 | - 'notnull' => true, |
|
| 267 | - 'length' => 64, |
|
| 268 | - 'default' => '', |
|
| 269 | - ]); |
|
| 270 | - $table->setPrimaryKey(['gid']); |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - if (!$schema->hasTable('preferences')) { |
|
| 274 | - $table = $schema->createTable('preferences'); |
|
| 275 | - $table->addColumn('userid', 'string', [ |
|
| 276 | - 'notnull' => true, |
|
| 277 | - 'length' => 64, |
|
| 278 | - 'default' => '', |
|
| 279 | - ]); |
|
| 280 | - $table->addColumn('appid', 'string', [ |
|
| 281 | - 'notnull' => true, |
|
| 282 | - 'length' => 32, |
|
| 283 | - 'default' => '', |
|
| 284 | - ]); |
|
| 285 | - $table->addColumn('configkey', 'string', [ |
|
| 286 | - 'notnull' => true, |
|
| 287 | - 'length' => 64, |
|
| 288 | - 'default' => '', |
|
| 289 | - ]); |
|
| 290 | - $table->addColumn('configvalue', 'text', [ |
|
| 291 | - 'notnull' => false, |
|
| 292 | - ]); |
|
| 293 | - $table->setPrimaryKey(['userid', 'appid', 'configkey']); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - if (!$schema->hasTable('properties')) { |
|
| 297 | - $table = $schema->createTable('properties'); |
|
| 298 | - $table->addColumn('id', 'integer', [ |
|
| 299 | - 'autoincrement' => true, |
|
| 300 | - 'notnull' => true, |
|
| 301 | - 'length' => 4, |
|
| 302 | - ]); |
|
| 303 | - $table->addColumn('userid', 'string', [ |
|
| 304 | - 'notnull' => true, |
|
| 305 | - 'length' => 64, |
|
| 306 | - 'default' => '', |
|
| 307 | - ]); |
|
| 308 | - $table->addColumn('propertypath', 'string', [ |
|
| 309 | - 'notnull' => true, |
|
| 310 | - 'length' => 255, |
|
| 311 | - 'default' => '', |
|
| 312 | - ]); |
|
| 313 | - $table->addColumn('propertyname', 'string', [ |
|
| 314 | - 'notnull' => true, |
|
| 315 | - 'length' => 255, |
|
| 316 | - 'default' => '', |
|
| 317 | - ]); |
|
| 318 | - $table->addColumn('propertyvalue', 'text', [ |
|
| 319 | - 'notnull' => true, |
|
| 320 | - ]); |
|
| 321 | - $table->setPrimaryKey(['id']); |
|
| 322 | - $table->addIndex(['userid'], 'property_index'); |
|
| 323 | - $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - if (!$schema->hasTable('share')) { |
|
| 327 | - $table = $schema->createTable('share'); |
|
| 328 | - $table->addColumn('id', 'integer', [ |
|
| 329 | - 'autoincrement' => true, |
|
| 330 | - 'notnull' => true, |
|
| 331 | - 'length' => 4, |
|
| 332 | - ]); |
|
| 333 | - $table->addColumn('share_type', 'smallint', [ |
|
| 334 | - 'notnull' => true, |
|
| 335 | - 'length' => 1, |
|
| 336 | - 'default' => 0, |
|
| 337 | - ]); |
|
| 338 | - $table->addColumn('share_with', 'string', [ |
|
| 339 | - 'notnull' => false, |
|
| 340 | - 'length' => 255, |
|
| 341 | - ]); |
|
| 342 | - $table->addColumn('password', 'string', [ |
|
| 343 | - 'notnull' => false, |
|
| 344 | - 'length' => 255, |
|
| 345 | - ]); |
|
| 346 | - $table->addColumn('uid_owner', 'string', [ |
|
| 347 | - 'notnull' => true, |
|
| 348 | - 'length' => 64, |
|
| 349 | - 'default' => '', |
|
| 350 | - ]); |
|
| 351 | - $table->addColumn('uid_initiator', 'string', [ |
|
| 352 | - 'notnull' => false, |
|
| 353 | - 'length' => 64, |
|
| 354 | - ]); |
|
| 355 | - $table->addColumn('parent', 'integer', [ |
|
| 356 | - 'notnull' => false, |
|
| 357 | - 'length' => 4, |
|
| 358 | - ]); |
|
| 359 | - $table->addColumn('item_type', 'string', [ |
|
| 360 | - 'notnull' => true, |
|
| 361 | - 'length' => 64, |
|
| 362 | - 'default' => '', |
|
| 363 | - ]); |
|
| 364 | - $table->addColumn('item_source', 'string', [ |
|
| 365 | - 'notnull' => false, |
|
| 366 | - 'length' => 255, |
|
| 367 | - ]); |
|
| 368 | - $table->addColumn('item_target', 'string', [ |
|
| 369 | - 'notnull' => false, |
|
| 370 | - 'length' => 255, |
|
| 371 | - ]); |
|
| 372 | - $table->addColumn('file_source', 'integer', [ |
|
| 373 | - 'notnull' => false, |
|
| 374 | - 'length' => 4, |
|
| 375 | - ]); |
|
| 376 | - $table->addColumn('file_target', 'string', [ |
|
| 377 | - 'notnull' => false, |
|
| 378 | - 'length' => 512, |
|
| 379 | - ]); |
|
| 380 | - $table->addColumn('permissions', 'smallint', [ |
|
| 381 | - 'notnull' => true, |
|
| 382 | - 'length' => 1, |
|
| 383 | - 'default' => 0, |
|
| 384 | - ]); |
|
| 385 | - $table->addColumn('stime', 'bigint', [ |
|
| 386 | - 'notnull' => true, |
|
| 387 | - 'length' => 8, |
|
| 388 | - 'default' => 0, |
|
| 389 | - ]); |
|
| 390 | - $table->addColumn('accepted', 'smallint', [ |
|
| 391 | - 'notnull' => true, |
|
| 392 | - 'length' => 1, |
|
| 393 | - 'default' => 0, |
|
| 394 | - ]); |
|
| 395 | - $table->addColumn('expiration', 'datetime', [ |
|
| 396 | - 'notnull' => false, |
|
| 397 | - ]); |
|
| 398 | - $table->addColumn('token', 'string', [ |
|
| 399 | - 'notnull' => false, |
|
| 400 | - 'length' => 32, |
|
| 401 | - ]); |
|
| 402 | - $table->addColumn('mail_send', 'smallint', [ |
|
| 403 | - 'notnull' => true, |
|
| 404 | - 'length' => 1, |
|
| 405 | - 'default' => 0, |
|
| 406 | - ]); |
|
| 407 | - $table->addColumn('share_name', 'string', [ |
|
| 408 | - 'notnull' => false, |
|
| 409 | - 'length' => 64, |
|
| 410 | - ]); |
|
| 411 | - $table->setPrimaryKey(['id']); |
|
| 412 | - $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); |
|
| 413 | - $table->addIndex(['file_source'], 'file_source_index'); |
|
| 414 | - $table->addIndex(['token'], 'token_index'); |
|
| 415 | - $table->addIndex(['share_with'], 'share_with_index'); |
|
| 416 | - $table->addIndex(['parent'], 'parent_index'); |
|
| 417 | - $table->addIndex(['uid_owner'], 'owner_index'); |
|
| 418 | - $table->addIndex(['uid_initiator'], 'initiator_index'); |
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - if (!$schema->hasTable('jobs')) { |
|
| 422 | - $table = $schema->createTable('jobs'); |
|
| 423 | - $table->addColumn('id', 'integer', [ |
|
| 424 | - 'autoincrement' => true, |
|
| 425 | - 'notnull' => true, |
|
| 426 | - 'length' => 4, |
|
| 427 | - 'unsigned' => true, |
|
| 428 | - ]); |
|
| 429 | - $table->addColumn('class', 'string', [ |
|
| 430 | - 'notnull' => true, |
|
| 431 | - 'length' => 255, |
|
| 432 | - 'default' => '', |
|
| 433 | - ]); |
|
| 434 | - $table->addColumn('argument', 'string', [ |
|
| 435 | - 'notnull' => true, |
|
| 436 | - 'length' => 4000, |
|
| 437 | - 'default' => '', |
|
| 438 | - ]); |
|
| 439 | - $table->addColumn('last_run', 'integer', [ |
|
| 440 | - 'notnull' => false, |
|
| 441 | - 'default' => 0, |
|
| 442 | - ]); |
|
| 443 | - $table->addColumn('last_checked', 'integer', [ |
|
| 444 | - 'notnull' => false, |
|
| 445 | - 'default' => 0, |
|
| 446 | - ]); |
|
| 447 | - $table->addColumn('reserved_at', 'integer', [ |
|
| 448 | - 'notnull' => false, |
|
| 449 | - 'default' => 0, |
|
| 450 | - ]); |
|
| 451 | - $table->addColumn('execution_duration', 'integer', [ |
|
| 452 | - 'notnull' => true, |
|
| 453 | - 'default' => 0, |
|
| 454 | - ]); |
|
| 455 | - $table->setPrimaryKey(['id']); |
|
| 456 | - $table->addIndex(['class'], 'job_class_index'); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - if (!$schema->hasTable('users')) { |
|
| 460 | - $table = $schema->createTable('users'); |
|
| 461 | - $table->addColumn('uid', 'string', [ |
|
| 462 | - 'notnull' => true, |
|
| 463 | - 'length' => 64, |
|
| 464 | - 'default' => '', |
|
| 465 | - ]); |
|
| 466 | - $table->addColumn('displayname', 'string', [ |
|
| 467 | - 'notnull' => false, |
|
| 468 | - 'length' => 64, |
|
| 469 | - ]); |
|
| 470 | - $table->addColumn('password', 'string', [ |
|
| 471 | - 'notnull' => true, |
|
| 472 | - 'length' => 255, |
|
| 473 | - 'default' => '', |
|
| 474 | - ]); |
|
| 475 | - $table->setPrimaryKey(['uid']); |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - if (!$schema->hasTable('authtoken')) { |
|
| 479 | - $table = $schema->createTable('authtoken'); |
|
| 480 | - $table->addColumn('id', 'integer', [ |
|
| 481 | - 'autoincrement' => true, |
|
| 482 | - 'notnull' => true, |
|
| 483 | - 'length' => 4, |
|
| 484 | - 'unsigned' => true, |
|
| 485 | - ]); |
|
| 486 | - $table->addColumn('uid', 'string', [ |
|
| 487 | - 'notnull' => true, |
|
| 488 | - 'length' => 64, |
|
| 489 | - 'default' => '', |
|
| 490 | - ]); |
|
| 491 | - $table->addColumn('login_name', 'string', [ |
|
| 492 | - 'notnull' => true, |
|
| 493 | - 'length' => 64, |
|
| 494 | - 'default' => '', |
|
| 495 | - ]); |
|
| 496 | - $table->addColumn('password', 'text', [ |
|
| 497 | - 'notnull' => false, |
|
| 498 | - ]); |
|
| 499 | - $table->addColumn('name', 'text', [ |
|
| 500 | - 'notnull' => true, |
|
| 501 | - 'default' => '', |
|
| 502 | - ]); |
|
| 503 | - $table->addColumn('token', 'string', [ |
|
| 504 | - 'notnull' => true, |
|
| 505 | - 'length' => 200, |
|
| 506 | - 'default' => '', |
|
| 507 | - ]); |
|
| 508 | - $table->addColumn('type', 'smallint', [ |
|
| 509 | - 'notnull' => true, |
|
| 510 | - 'length' => 2, |
|
| 511 | - 'default' => 0, |
|
| 512 | - 'unsigned' => true, |
|
| 513 | - ]); |
|
| 514 | - $table->addColumn('remember', 'smallint', [ |
|
| 515 | - 'notnull' => true, |
|
| 516 | - 'length' => 1, |
|
| 517 | - 'default' => 0, |
|
| 518 | - 'unsigned' => true, |
|
| 519 | - ]); |
|
| 520 | - $table->addColumn('last_activity', 'integer', [ |
|
| 521 | - 'notnull' => true, |
|
| 522 | - 'length' => 4, |
|
| 523 | - 'default' => 0, |
|
| 524 | - 'unsigned' => true, |
|
| 525 | - ]); |
|
| 526 | - $table->addColumn('last_check', 'integer', [ |
|
| 527 | - 'notnull' => true, |
|
| 528 | - 'length' => 4, |
|
| 529 | - 'default' => 0, |
|
| 530 | - 'unsigned' => true, |
|
| 531 | - ]); |
|
| 532 | - $table->addColumn('scope', 'text', [ |
|
| 533 | - 'notnull' => false, |
|
| 534 | - ]); |
|
| 535 | - $table->setPrimaryKey(['id']); |
|
| 536 | - $table->addUniqueIndex(['token'], 'authtoken_token_index'); |
|
| 537 | - $table->addIndex(['last_activity'], 'authtoken_last_activity_idx'); |
|
| 538 | - } |
|
| 539 | - |
|
| 540 | - if (!$schema->hasTable('bruteforce_attempts')) { |
|
| 541 | - $table = $schema->createTable('bruteforce_attempts'); |
|
| 542 | - $table->addColumn('id', 'integer', [ |
|
| 543 | - 'autoincrement' => true, |
|
| 544 | - 'notnull' => true, |
|
| 545 | - 'length' => 4, |
|
| 546 | - 'unsigned' => true, |
|
| 547 | - ]); |
|
| 548 | - $table->addColumn('action', 'string', [ |
|
| 549 | - 'notnull' => true, |
|
| 550 | - 'length' => 64, |
|
| 551 | - 'default' => '', |
|
| 552 | - ]); |
|
| 553 | - $table->addColumn('occurred', 'integer', [ |
|
| 554 | - 'notnull' => true, |
|
| 555 | - 'length' => 4, |
|
| 556 | - 'default' => 0, |
|
| 557 | - 'unsigned' => true, |
|
| 558 | - ]); |
|
| 559 | - $table->addColumn('ip', 'string', [ |
|
| 560 | - 'notnull' => true, |
|
| 561 | - 'length' => 255, |
|
| 562 | - 'default' => '', |
|
| 563 | - ]); |
|
| 564 | - $table->addColumn('subnet', 'string', [ |
|
| 565 | - 'notnull' => true, |
|
| 566 | - 'length' => 255, |
|
| 567 | - 'default' => '', |
|
| 568 | - ]); |
|
| 569 | - $table->addColumn('metadata', 'string', [ |
|
| 570 | - 'notnull' => true, |
|
| 571 | - 'length' => 255, |
|
| 572 | - 'default' => '', |
|
| 573 | - ]); |
|
| 574 | - $table->setPrimaryKey(['id']); |
|
| 575 | - $table->addIndex(['ip'], 'bruteforce_attempts_ip'); |
|
| 576 | - $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - if (!$schema->hasTable('vcategory')) { |
|
| 580 | - $table = $schema->createTable('vcategory'); |
|
| 581 | - $table->addColumn('id', 'integer', [ |
|
| 582 | - 'autoincrement' => true, |
|
| 583 | - 'notnull' => true, |
|
| 584 | - 'length' => 4, |
|
| 585 | - 'unsigned' => true, |
|
| 586 | - ]); |
|
| 587 | - $table->addColumn('uid', 'string', [ |
|
| 588 | - 'notnull' => true, |
|
| 589 | - 'length' => 64, |
|
| 590 | - 'default' => '', |
|
| 591 | - ]); |
|
| 592 | - $table->addColumn('type', 'string', [ |
|
| 593 | - 'notnull' => true, |
|
| 594 | - 'length' => 64, |
|
| 595 | - 'default' => '', |
|
| 596 | - ]); |
|
| 597 | - $table->addColumn('category', 'string', [ |
|
| 598 | - 'notnull' => true, |
|
| 599 | - 'length' => 255, |
|
| 600 | - 'default' => '', |
|
| 601 | - ]); |
|
| 602 | - $table->setPrimaryKey(['id']); |
|
| 603 | - $table->addIndex(['uid'], 'uid_index'); |
|
| 604 | - $table->addIndex(['type'], 'type_index'); |
|
| 605 | - $table->addIndex(['category'], 'category_index'); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - if (!$schema->hasTable('vcategory_to_object')) { |
|
| 609 | - $table = $schema->createTable('vcategory_to_object'); |
|
| 610 | - $table->addColumn('objid', 'integer', [ |
|
| 611 | - 'notnull' => true, |
|
| 612 | - 'length' => 4, |
|
| 613 | - 'default' => 0, |
|
| 614 | - 'unsigned' => true, |
|
| 615 | - ]); |
|
| 616 | - $table->addColumn('categoryid', 'integer', [ |
|
| 617 | - 'notnull' => true, |
|
| 618 | - 'length' => 4, |
|
| 619 | - 'default' => 0, |
|
| 620 | - 'unsigned' => true, |
|
| 621 | - ]); |
|
| 622 | - $table->addColumn('type', 'string', [ |
|
| 623 | - 'notnull' => true, |
|
| 624 | - 'length' => 64, |
|
| 625 | - 'default' => '', |
|
| 626 | - ]); |
|
| 627 | - $table->setPrimaryKey(['categoryid', 'objid', 'type']); |
|
| 628 | - $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); |
|
| 629 | - } |
|
| 630 | - |
|
| 631 | - if (!$schema->hasTable('systemtag')) { |
|
| 632 | - $table = $schema->createTable('systemtag'); |
|
| 633 | - $table->addColumn('id', 'integer', [ |
|
| 634 | - 'autoincrement' => true, |
|
| 635 | - 'notnull' => true, |
|
| 636 | - 'length' => 4, |
|
| 637 | - 'unsigned' => true, |
|
| 638 | - ]); |
|
| 639 | - $table->addColumn('name', 'string', [ |
|
| 640 | - 'notnull' => true, |
|
| 641 | - 'length' => 64, |
|
| 642 | - 'default' => '', |
|
| 643 | - ]); |
|
| 644 | - $table->addColumn('visibility', 'smallint', [ |
|
| 645 | - 'notnull' => true, |
|
| 646 | - 'length' => 1, |
|
| 647 | - 'default' => 1, |
|
| 648 | - ]); |
|
| 649 | - $table->addColumn('editable', 'smallint', [ |
|
| 650 | - 'notnull' => true, |
|
| 651 | - 'length' => 1, |
|
| 652 | - 'default' => 1, |
|
| 653 | - ]); |
|
| 654 | - $table->setPrimaryKey(['id']); |
|
| 655 | - $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); |
|
| 656 | - } |
|
| 657 | - |
|
| 658 | - if (!$schema->hasTable('systemtag_object_mapping')) { |
|
| 659 | - $table = $schema->createTable('systemtag_object_mapping'); |
|
| 660 | - $table->addColumn('objectid', 'string', [ |
|
| 661 | - 'notnull' => true, |
|
| 662 | - 'length' => 64, |
|
| 663 | - 'default' => '', |
|
| 664 | - ]); |
|
| 665 | - $table->addColumn('objecttype', 'string', [ |
|
| 666 | - 'notnull' => true, |
|
| 667 | - 'length' => 64, |
|
| 668 | - 'default' => '', |
|
| 669 | - ]); |
|
| 670 | - $table->addColumn('systemtagid', 'integer', [ |
|
| 671 | - 'notnull' => true, |
|
| 672 | - 'length' => 4, |
|
| 673 | - 'default' => 0, |
|
| 674 | - 'unsigned' => true, |
|
| 675 | - ]); |
|
| 676 | - $table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk'); |
|
| 39 | + /** |
|
| 40 | + * @param IOutput $output |
|
| 41 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 42 | + * @param array $options |
|
| 43 | + * @return null|ISchemaWrapper |
|
| 44 | + * @since 13.0.0 |
|
| 45 | + */ |
|
| 46 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 47 | + /** @var ISchemaWrapper $schema */ |
|
| 48 | + $schema = $schemaClosure(); |
|
| 49 | + |
|
| 50 | + if (!$schema->hasTable('appconfig')) { |
|
| 51 | + $table = $schema->createTable('appconfig'); |
|
| 52 | + $table->addColumn('appid', 'string', [ |
|
| 53 | + 'notnull' => true, |
|
| 54 | + 'length' => 32, |
|
| 55 | + 'default' => '', |
|
| 56 | + ]); |
|
| 57 | + $table->addColumn('configkey', 'string', [ |
|
| 58 | + 'notnull' => true, |
|
| 59 | + 'length' => 64, |
|
| 60 | + 'default' => '', |
|
| 61 | + ]); |
|
| 62 | + $table->addColumn('configvalue', 'text', [ |
|
| 63 | + 'notnull' => false, |
|
| 64 | + ]); |
|
| 65 | + $table->setPrimaryKey(['appid', 'configkey']); |
|
| 66 | + $table->addIndex(['configkey'], 'appconfig_config_key_index'); |
|
| 67 | + $table->addIndex(['appid'], 'appconfig_appid_key'); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (!$schema->hasTable('storages')) { |
|
| 71 | + $table = $schema->createTable('storages'); |
|
| 72 | + $table->addColumn('id', 'string', [ |
|
| 73 | + 'notnull' => false, |
|
| 74 | + 'length' => 64, |
|
| 75 | + ]); |
|
| 76 | + $table->addColumn('numeric_id', Types::BIGINT, [ |
|
| 77 | + 'autoincrement' => true, |
|
| 78 | + 'notnull' => true, |
|
| 79 | + 'length' => 20, |
|
| 80 | + ]); |
|
| 81 | + $table->addColumn('available', 'integer', [ |
|
| 82 | + 'notnull' => true, |
|
| 83 | + 'default' => 1, |
|
| 84 | + ]); |
|
| 85 | + $table->addColumn('last_checked', 'integer', [ |
|
| 86 | + 'notnull' => false, |
|
| 87 | + ]); |
|
| 88 | + $table->setPrimaryKey(['numeric_id']); |
|
| 89 | + $table->addUniqueIndex(['id'], 'storages_id_index'); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if (!$schema->hasTable('mounts')) { |
|
| 93 | + $table = $schema->createTable('mounts'); |
|
| 94 | + $table->addColumn('id', 'integer', [ |
|
| 95 | + 'autoincrement' => true, |
|
| 96 | + 'notnull' => true, |
|
| 97 | + 'length' => 4, |
|
| 98 | + ]); |
|
| 99 | + $table->addColumn('storage_id', Types::BIGINT, [ |
|
| 100 | + 'notnull' => true, |
|
| 101 | + 'length' => 20, |
|
| 102 | + ]); |
|
| 103 | + $table->addColumn('root_id', Types::BIGINT, [ |
|
| 104 | + 'notnull' => true, |
|
| 105 | + 'length' => 20, |
|
| 106 | + ]); |
|
| 107 | + $table->addColumn('user_id', 'string', [ |
|
| 108 | + 'notnull' => true, |
|
| 109 | + 'length' => 64, |
|
| 110 | + ]); |
|
| 111 | + $table->addColumn('mount_point', 'string', [ |
|
| 112 | + 'notnull' => true, |
|
| 113 | + 'length' => 4000, |
|
| 114 | + ]); |
|
| 115 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 116 | + 'notnull' => false, |
|
| 117 | + 'length' => 20, |
|
| 118 | + ]); |
|
| 119 | + $table->setPrimaryKey(['id']); |
|
| 120 | + $table->addIndex(['user_id'], 'mounts_user_index'); |
|
| 121 | + $table->addIndex(['storage_id'], 'mounts_storage_index'); |
|
| 122 | + $table->addIndex(['root_id'], 'mounts_root_index'); |
|
| 123 | + $table->addIndex(['mount_id'], 'mounts_mount_id_index'); |
|
| 124 | + $table->addUniqueIndex(['user_id', 'root_id'], 'mounts_user_root_index'); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + if (!$schema->hasTable('mimetypes')) { |
|
| 128 | + $table = $schema->createTable('mimetypes'); |
|
| 129 | + $table->addColumn('id', Types::BIGINT, [ |
|
| 130 | + 'autoincrement' => true, |
|
| 131 | + 'notnull' => true, |
|
| 132 | + 'length' => 20, |
|
| 133 | + ]); |
|
| 134 | + $table->addColumn('mimetype', 'string', [ |
|
| 135 | + 'notnull' => true, |
|
| 136 | + 'length' => 255, |
|
| 137 | + 'default' => '', |
|
| 138 | + ]); |
|
| 139 | + $table->setPrimaryKey(['id']); |
|
| 140 | + $table->addUniqueIndex(['mimetype'], 'mimetype_id_index'); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if (!$schema->hasTable('filecache')) { |
|
| 144 | + $table = $schema->createTable('filecache'); |
|
| 145 | + $table->addColumn('fileid', Types::BIGINT, [ |
|
| 146 | + 'autoincrement' => true, |
|
| 147 | + 'notnull' => true, |
|
| 148 | + 'length' => 20, |
|
| 149 | + ]); |
|
| 150 | + $table->addColumn('storage', Types::BIGINT, [ |
|
| 151 | + 'notnull' => true, |
|
| 152 | + 'length' => 20, |
|
| 153 | + 'default' => 0, |
|
| 154 | + ]); |
|
| 155 | + $table->addColumn('path', 'string', [ |
|
| 156 | + 'notnull' => false, |
|
| 157 | + 'length' => 4000, |
|
| 158 | + ]); |
|
| 159 | + $table->addColumn('path_hash', 'string', [ |
|
| 160 | + 'notnull' => true, |
|
| 161 | + 'length' => 32, |
|
| 162 | + 'default' => '', |
|
| 163 | + ]); |
|
| 164 | + $table->addColumn('parent', Types::BIGINT, [ |
|
| 165 | + 'notnull' => true, |
|
| 166 | + 'length' => 20, |
|
| 167 | + 'default' => 0, |
|
| 168 | + ]); |
|
| 169 | + $table->addColumn('name', 'string', [ |
|
| 170 | + 'notnull' => false, |
|
| 171 | + 'length' => 250, |
|
| 172 | + ]); |
|
| 173 | + $table->addColumn('mimetype', Types::BIGINT, [ |
|
| 174 | + 'notnull' => true, |
|
| 175 | + 'length' => 20, |
|
| 176 | + 'default' => 0, |
|
| 177 | + ]); |
|
| 178 | + $table->addColumn('mimepart', Types::BIGINT, [ |
|
| 179 | + 'notnull' => true, |
|
| 180 | + 'length' => 20, |
|
| 181 | + 'default' => 0, |
|
| 182 | + ]); |
|
| 183 | + $table->addColumn('size', 'bigint', [ |
|
| 184 | + 'notnull' => true, |
|
| 185 | + 'length' => 8, |
|
| 186 | + 'default' => 0, |
|
| 187 | + ]); |
|
| 188 | + $table->addColumn('mtime', Types::BIGINT, [ |
|
| 189 | + 'notnull' => true, |
|
| 190 | + 'length' => 20, |
|
| 191 | + 'default' => 0, |
|
| 192 | + ]); |
|
| 193 | + $table->addColumn('storage_mtime', Types::BIGINT, [ |
|
| 194 | + 'notnull' => true, |
|
| 195 | + 'length' => 20, |
|
| 196 | + 'default' => 0, |
|
| 197 | + ]); |
|
| 198 | + $table->addColumn('encrypted', 'integer', [ |
|
| 199 | + 'notnull' => true, |
|
| 200 | + 'length' => 4, |
|
| 201 | + 'default' => 0, |
|
| 202 | + ]); |
|
| 203 | + $table->addColumn('unencrypted_size', 'bigint', [ |
|
| 204 | + 'notnull' => true, |
|
| 205 | + 'length' => 8, |
|
| 206 | + 'default' => 0, |
|
| 207 | + ]); |
|
| 208 | + $table->addColumn('etag', 'string', [ |
|
| 209 | + 'notnull' => false, |
|
| 210 | + 'length' => 40, |
|
| 211 | + ]); |
|
| 212 | + $table->addColumn('permissions', 'integer', [ |
|
| 213 | + 'notnull' => false, |
|
| 214 | + 'length' => 4, |
|
| 215 | + 'default' => 0, |
|
| 216 | + ]); |
|
| 217 | + $table->addColumn('checksum', 'string', [ |
|
| 218 | + 'notnull' => false, |
|
| 219 | + 'length' => 255, |
|
| 220 | + ]); |
|
| 221 | + $table->setPrimaryKey(['fileid']); |
|
| 222 | + $table->addUniqueIndex(['storage', 'path_hash'], 'fs_storage_path_hash'); |
|
| 223 | + $table->addIndex(['parent', 'name'], 'fs_parent_name_hash'); |
|
| 224 | + $table->addIndex(['storage', 'mimetype'], 'fs_storage_mimetype'); |
|
| 225 | + $table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart'); |
|
| 226 | + $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); |
|
| 227 | + $table->addIndex(['mtime'], 'fs_mtime'); |
|
| 228 | + $table->addIndex(['size'], 'fs_size'); |
|
| 229 | + } |
|
| 230 | + |
|
| 231 | + if (!$schema->hasTable('group_user')) { |
|
| 232 | + $table = $schema->createTable('group_user'); |
|
| 233 | + $table->addColumn('gid', 'string', [ |
|
| 234 | + 'notnull' => true, |
|
| 235 | + 'length' => 64, |
|
| 236 | + 'default' => '', |
|
| 237 | + ]); |
|
| 238 | + $table->addColumn('uid', 'string', [ |
|
| 239 | + 'notnull' => true, |
|
| 240 | + 'length' => 64, |
|
| 241 | + 'default' => '', |
|
| 242 | + ]); |
|
| 243 | + $table->setPrimaryKey(['gid', 'uid']); |
|
| 244 | + $table->addIndex(['uid'], 'gu_uid_index'); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + if (!$schema->hasTable('group_admin')) { |
|
| 248 | + $table = $schema->createTable('group_admin'); |
|
| 249 | + $table->addColumn('gid', 'string', [ |
|
| 250 | + 'notnull' => true, |
|
| 251 | + 'length' => 64, |
|
| 252 | + 'default' => '', |
|
| 253 | + ]); |
|
| 254 | + $table->addColumn('uid', 'string', [ |
|
| 255 | + 'notnull' => true, |
|
| 256 | + 'length' => 64, |
|
| 257 | + 'default' => '', |
|
| 258 | + ]); |
|
| 259 | + $table->setPrimaryKey(['gid', 'uid']); |
|
| 260 | + $table->addIndex(['uid'], 'group_admin_uid'); |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + if (!$schema->hasTable('groups')) { |
|
| 264 | + $table = $schema->createTable('groups'); |
|
| 265 | + $table->addColumn('gid', 'string', [ |
|
| 266 | + 'notnull' => true, |
|
| 267 | + 'length' => 64, |
|
| 268 | + 'default' => '', |
|
| 269 | + ]); |
|
| 270 | + $table->setPrimaryKey(['gid']); |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + if (!$schema->hasTable('preferences')) { |
|
| 274 | + $table = $schema->createTable('preferences'); |
|
| 275 | + $table->addColumn('userid', 'string', [ |
|
| 276 | + 'notnull' => true, |
|
| 277 | + 'length' => 64, |
|
| 278 | + 'default' => '', |
|
| 279 | + ]); |
|
| 280 | + $table->addColumn('appid', 'string', [ |
|
| 281 | + 'notnull' => true, |
|
| 282 | + 'length' => 32, |
|
| 283 | + 'default' => '', |
|
| 284 | + ]); |
|
| 285 | + $table->addColumn('configkey', 'string', [ |
|
| 286 | + 'notnull' => true, |
|
| 287 | + 'length' => 64, |
|
| 288 | + 'default' => '', |
|
| 289 | + ]); |
|
| 290 | + $table->addColumn('configvalue', 'text', [ |
|
| 291 | + 'notnull' => false, |
|
| 292 | + ]); |
|
| 293 | + $table->setPrimaryKey(['userid', 'appid', 'configkey']); |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + if (!$schema->hasTable('properties')) { |
|
| 297 | + $table = $schema->createTable('properties'); |
|
| 298 | + $table->addColumn('id', 'integer', [ |
|
| 299 | + 'autoincrement' => true, |
|
| 300 | + 'notnull' => true, |
|
| 301 | + 'length' => 4, |
|
| 302 | + ]); |
|
| 303 | + $table->addColumn('userid', 'string', [ |
|
| 304 | + 'notnull' => true, |
|
| 305 | + 'length' => 64, |
|
| 306 | + 'default' => '', |
|
| 307 | + ]); |
|
| 308 | + $table->addColumn('propertypath', 'string', [ |
|
| 309 | + 'notnull' => true, |
|
| 310 | + 'length' => 255, |
|
| 311 | + 'default' => '', |
|
| 312 | + ]); |
|
| 313 | + $table->addColumn('propertyname', 'string', [ |
|
| 314 | + 'notnull' => true, |
|
| 315 | + 'length' => 255, |
|
| 316 | + 'default' => '', |
|
| 317 | + ]); |
|
| 318 | + $table->addColumn('propertyvalue', 'text', [ |
|
| 319 | + 'notnull' => true, |
|
| 320 | + ]); |
|
| 321 | + $table->setPrimaryKey(['id']); |
|
| 322 | + $table->addIndex(['userid'], 'property_index'); |
|
| 323 | + $table->addIndex(['userid', 'propertypath'], 'properties_path_index'); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + if (!$schema->hasTable('share')) { |
|
| 327 | + $table = $schema->createTable('share'); |
|
| 328 | + $table->addColumn('id', 'integer', [ |
|
| 329 | + 'autoincrement' => true, |
|
| 330 | + 'notnull' => true, |
|
| 331 | + 'length' => 4, |
|
| 332 | + ]); |
|
| 333 | + $table->addColumn('share_type', 'smallint', [ |
|
| 334 | + 'notnull' => true, |
|
| 335 | + 'length' => 1, |
|
| 336 | + 'default' => 0, |
|
| 337 | + ]); |
|
| 338 | + $table->addColumn('share_with', 'string', [ |
|
| 339 | + 'notnull' => false, |
|
| 340 | + 'length' => 255, |
|
| 341 | + ]); |
|
| 342 | + $table->addColumn('password', 'string', [ |
|
| 343 | + 'notnull' => false, |
|
| 344 | + 'length' => 255, |
|
| 345 | + ]); |
|
| 346 | + $table->addColumn('uid_owner', 'string', [ |
|
| 347 | + 'notnull' => true, |
|
| 348 | + 'length' => 64, |
|
| 349 | + 'default' => '', |
|
| 350 | + ]); |
|
| 351 | + $table->addColumn('uid_initiator', 'string', [ |
|
| 352 | + 'notnull' => false, |
|
| 353 | + 'length' => 64, |
|
| 354 | + ]); |
|
| 355 | + $table->addColumn('parent', 'integer', [ |
|
| 356 | + 'notnull' => false, |
|
| 357 | + 'length' => 4, |
|
| 358 | + ]); |
|
| 359 | + $table->addColumn('item_type', 'string', [ |
|
| 360 | + 'notnull' => true, |
|
| 361 | + 'length' => 64, |
|
| 362 | + 'default' => '', |
|
| 363 | + ]); |
|
| 364 | + $table->addColumn('item_source', 'string', [ |
|
| 365 | + 'notnull' => false, |
|
| 366 | + 'length' => 255, |
|
| 367 | + ]); |
|
| 368 | + $table->addColumn('item_target', 'string', [ |
|
| 369 | + 'notnull' => false, |
|
| 370 | + 'length' => 255, |
|
| 371 | + ]); |
|
| 372 | + $table->addColumn('file_source', 'integer', [ |
|
| 373 | + 'notnull' => false, |
|
| 374 | + 'length' => 4, |
|
| 375 | + ]); |
|
| 376 | + $table->addColumn('file_target', 'string', [ |
|
| 377 | + 'notnull' => false, |
|
| 378 | + 'length' => 512, |
|
| 379 | + ]); |
|
| 380 | + $table->addColumn('permissions', 'smallint', [ |
|
| 381 | + 'notnull' => true, |
|
| 382 | + 'length' => 1, |
|
| 383 | + 'default' => 0, |
|
| 384 | + ]); |
|
| 385 | + $table->addColumn('stime', 'bigint', [ |
|
| 386 | + 'notnull' => true, |
|
| 387 | + 'length' => 8, |
|
| 388 | + 'default' => 0, |
|
| 389 | + ]); |
|
| 390 | + $table->addColumn('accepted', 'smallint', [ |
|
| 391 | + 'notnull' => true, |
|
| 392 | + 'length' => 1, |
|
| 393 | + 'default' => 0, |
|
| 394 | + ]); |
|
| 395 | + $table->addColumn('expiration', 'datetime', [ |
|
| 396 | + 'notnull' => false, |
|
| 397 | + ]); |
|
| 398 | + $table->addColumn('token', 'string', [ |
|
| 399 | + 'notnull' => false, |
|
| 400 | + 'length' => 32, |
|
| 401 | + ]); |
|
| 402 | + $table->addColumn('mail_send', 'smallint', [ |
|
| 403 | + 'notnull' => true, |
|
| 404 | + 'length' => 1, |
|
| 405 | + 'default' => 0, |
|
| 406 | + ]); |
|
| 407 | + $table->addColumn('share_name', 'string', [ |
|
| 408 | + 'notnull' => false, |
|
| 409 | + 'length' => 64, |
|
| 410 | + ]); |
|
| 411 | + $table->setPrimaryKey(['id']); |
|
| 412 | + $table->addIndex(['item_type', 'share_type'], 'item_share_type_index'); |
|
| 413 | + $table->addIndex(['file_source'], 'file_source_index'); |
|
| 414 | + $table->addIndex(['token'], 'token_index'); |
|
| 415 | + $table->addIndex(['share_with'], 'share_with_index'); |
|
| 416 | + $table->addIndex(['parent'], 'parent_index'); |
|
| 417 | + $table->addIndex(['uid_owner'], 'owner_index'); |
|
| 418 | + $table->addIndex(['uid_initiator'], 'initiator_index'); |
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + if (!$schema->hasTable('jobs')) { |
|
| 422 | + $table = $schema->createTable('jobs'); |
|
| 423 | + $table->addColumn('id', 'integer', [ |
|
| 424 | + 'autoincrement' => true, |
|
| 425 | + 'notnull' => true, |
|
| 426 | + 'length' => 4, |
|
| 427 | + 'unsigned' => true, |
|
| 428 | + ]); |
|
| 429 | + $table->addColumn('class', 'string', [ |
|
| 430 | + 'notnull' => true, |
|
| 431 | + 'length' => 255, |
|
| 432 | + 'default' => '', |
|
| 433 | + ]); |
|
| 434 | + $table->addColumn('argument', 'string', [ |
|
| 435 | + 'notnull' => true, |
|
| 436 | + 'length' => 4000, |
|
| 437 | + 'default' => '', |
|
| 438 | + ]); |
|
| 439 | + $table->addColumn('last_run', 'integer', [ |
|
| 440 | + 'notnull' => false, |
|
| 441 | + 'default' => 0, |
|
| 442 | + ]); |
|
| 443 | + $table->addColumn('last_checked', 'integer', [ |
|
| 444 | + 'notnull' => false, |
|
| 445 | + 'default' => 0, |
|
| 446 | + ]); |
|
| 447 | + $table->addColumn('reserved_at', 'integer', [ |
|
| 448 | + 'notnull' => false, |
|
| 449 | + 'default' => 0, |
|
| 450 | + ]); |
|
| 451 | + $table->addColumn('execution_duration', 'integer', [ |
|
| 452 | + 'notnull' => true, |
|
| 453 | + 'default' => 0, |
|
| 454 | + ]); |
|
| 455 | + $table->setPrimaryKey(['id']); |
|
| 456 | + $table->addIndex(['class'], 'job_class_index'); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + if (!$schema->hasTable('users')) { |
|
| 460 | + $table = $schema->createTable('users'); |
|
| 461 | + $table->addColumn('uid', 'string', [ |
|
| 462 | + 'notnull' => true, |
|
| 463 | + 'length' => 64, |
|
| 464 | + 'default' => '', |
|
| 465 | + ]); |
|
| 466 | + $table->addColumn('displayname', 'string', [ |
|
| 467 | + 'notnull' => false, |
|
| 468 | + 'length' => 64, |
|
| 469 | + ]); |
|
| 470 | + $table->addColumn('password', 'string', [ |
|
| 471 | + 'notnull' => true, |
|
| 472 | + 'length' => 255, |
|
| 473 | + 'default' => '', |
|
| 474 | + ]); |
|
| 475 | + $table->setPrimaryKey(['uid']); |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + if (!$schema->hasTable('authtoken')) { |
|
| 479 | + $table = $schema->createTable('authtoken'); |
|
| 480 | + $table->addColumn('id', 'integer', [ |
|
| 481 | + 'autoincrement' => true, |
|
| 482 | + 'notnull' => true, |
|
| 483 | + 'length' => 4, |
|
| 484 | + 'unsigned' => true, |
|
| 485 | + ]); |
|
| 486 | + $table->addColumn('uid', 'string', [ |
|
| 487 | + 'notnull' => true, |
|
| 488 | + 'length' => 64, |
|
| 489 | + 'default' => '', |
|
| 490 | + ]); |
|
| 491 | + $table->addColumn('login_name', 'string', [ |
|
| 492 | + 'notnull' => true, |
|
| 493 | + 'length' => 64, |
|
| 494 | + 'default' => '', |
|
| 495 | + ]); |
|
| 496 | + $table->addColumn('password', 'text', [ |
|
| 497 | + 'notnull' => false, |
|
| 498 | + ]); |
|
| 499 | + $table->addColumn('name', 'text', [ |
|
| 500 | + 'notnull' => true, |
|
| 501 | + 'default' => '', |
|
| 502 | + ]); |
|
| 503 | + $table->addColumn('token', 'string', [ |
|
| 504 | + 'notnull' => true, |
|
| 505 | + 'length' => 200, |
|
| 506 | + 'default' => '', |
|
| 507 | + ]); |
|
| 508 | + $table->addColumn('type', 'smallint', [ |
|
| 509 | + 'notnull' => true, |
|
| 510 | + 'length' => 2, |
|
| 511 | + 'default' => 0, |
|
| 512 | + 'unsigned' => true, |
|
| 513 | + ]); |
|
| 514 | + $table->addColumn('remember', 'smallint', [ |
|
| 515 | + 'notnull' => true, |
|
| 516 | + 'length' => 1, |
|
| 517 | + 'default' => 0, |
|
| 518 | + 'unsigned' => true, |
|
| 519 | + ]); |
|
| 520 | + $table->addColumn('last_activity', 'integer', [ |
|
| 521 | + 'notnull' => true, |
|
| 522 | + 'length' => 4, |
|
| 523 | + 'default' => 0, |
|
| 524 | + 'unsigned' => true, |
|
| 525 | + ]); |
|
| 526 | + $table->addColumn('last_check', 'integer', [ |
|
| 527 | + 'notnull' => true, |
|
| 528 | + 'length' => 4, |
|
| 529 | + 'default' => 0, |
|
| 530 | + 'unsigned' => true, |
|
| 531 | + ]); |
|
| 532 | + $table->addColumn('scope', 'text', [ |
|
| 533 | + 'notnull' => false, |
|
| 534 | + ]); |
|
| 535 | + $table->setPrimaryKey(['id']); |
|
| 536 | + $table->addUniqueIndex(['token'], 'authtoken_token_index'); |
|
| 537 | + $table->addIndex(['last_activity'], 'authtoken_last_activity_idx'); |
|
| 538 | + } |
|
| 539 | + |
|
| 540 | + if (!$schema->hasTable('bruteforce_attempts')) { |
|
| 541 | + $table = $schema->createTable('bruteforce_attempts'); |
|
| 542 | + $table->addColumn('id', 'integer', [ |
|
| 543 | + 'autoincrement' => true, |
|
| 544 | + 'notnull' => true, |
|
| 545 | + 'length' => 4, |
|
| 546 | + 'unsigned' => true, |
|
| 547 | + ]); |
|
| 548 | + $table->addColumn('action', 'string', [ |
|
| 549 | + 'notnull' => true, |
|
| 550 | + 'length' => 64, |
|
| 551 | + 'default' => '', |
|
| 552 | + ]); |
|
| 553 | + $table->addColumn('occurred', 'integer', [ |
|
| 554 | + 'notnull' => true, |
|
| 555 | + 'length' => 4, |
|
| 556 | + 'default' => 0, |
|
| 557 | + 'unsigned' => true, |
|
| 558 | + ]); |
|
| 559 | + $table->addColumn('ip', 'string', [ |
|
| 560 | + 'notnull' => true, |
|
| 561 | + 'length' => 255, |
|
| 562 | + 'default' => '', |
|
| 563 | + ]); |
|
| 564 | + $table->addColumn('subnet', 'string', [ |
|
| 565 | + 'notnull' => true, |
|
| 566 | + 'length' => 255, |
|
| 567 | + 'default' => '', |
|
| 568 | + ]); |
|
| 569 | + $table->addColumn('metadata', 'string', [ |
|
| 570 | + 'notnull' => true, |
|
| 571 | + 'length' => 255, |
|
| 572 | + 'default' => '', |
|
| 573 | + ]); |
|
| 574 | + $table->setPrimaryKey(['id']); |
|
| 575 | + $table->addIndex(['ip'], 'bruteforce_attempts_ip'); |
|
| 576 | + $table->addIndex(['subnet'], 'bruteforce_attempts_subnet'); |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + if (!$schema->hasTable('vcategory')) { |
|
| 580 | + $table = $schema->createTable('vcategory'); |
|
| 581 | + $table->addColumn('id', 'integer', [ |
|
| 582 | + 'autoincrement' => true, |
|
| 583 | + 'notnull' => true, |
|
| 584 | + 'length' => 4, |
|
| 585 | + 'unsigned' => true, |
|
| 586 | + ]); |
|
| 587 | + $table->addColumn('uid', 'string', [ |
|
| 588 | + 'notnull' => true, |
|
| 589 | + 'length' => 64, |
|
| 590 | + 'default' => '', |
|
| 591 | + ]); |
|
| 592 | + $table->addColumn('type', 'string', [ |
|
| 593 | + 'notnull' => true, |
|
| 594 | + 'length' => 64, |
|
| 595 | + 'default' => '', |
|
| 596 | + ]); |
|
| 597 | + $table->addColumn('category', 'string', [ |
|
| 598 | + 'notnull' => true, |
|
| 599 | + 'length' => 255, |
|
| 600 | + 'default' => '', |
|
| 601 | + ]); |
|
| 602 | + $table->setPrimaryKey(['id']); |
|
| 603 | + $table->addIndex(['uid'], 'uid_index'); |
|
| 604 | + $table->addIndex(['type'], 'type_index'); |
|
| 605 | + $table->addIndex(['category'], 'category_index'); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + if (!$schema->hasTable('vcategory_to_object')) { |
|
| 609 | + $table = $schema->createTable('vcategory_to_object'); |
|
| 610 | + $table->addColumn('objid', 'integer', [ |
|
| 611 | + 'notnull' => true, |
|
| 612 | + 'length' => 4, |
|
| 613 | + 'default' => 0, |
|
| 614 | + 'unsigned' => true, |
|
| 615 | + ]); |
|
| 616 | + $table->addColumn('categoryid', 'integer', [ |
|
| 617 | + 'notnull' => true, |
|
| 618 | + 'length' => 4, |
|
| 619 | + 'default' => 0, |
|
| 620 | + 'unsigned' => true, |
|
| 621 | + ]); |
|
| 622 | + $table->addColumn('type', 'string', [ |
|
| 623 | + 'notnull' => true, |
|
| 624 | + 'length' => 64, |
|
| 625 | + 'default' => '', |
|
| 626 | + ]); |
|
| 627 | + $table->setPrimaryKey(['categoryid', 'objid', 'type']); |
|
| 628 | + $table->addIndex(['objid', 'type'], 'vcategory_objectd_index'); |
|
| 629 | + } |
|
| 630 | + |
|
| 631 | + if (!$schema->hasTable('systemtag')) { |
|
| 632 | + $table = $schema->createTable('systemtag'); |
|
| 633 | + $table->addColumn('id', 'integer', [ |
|
| 634 | + 'autoincrement' => true, |
|
| 635 | + 'notnull' => true, |
|
| 636 | + 'length' => 4, |
|
| 637 | + 'unsigned' => true, |
|
| 638 | + ]); |
|
| 639 | + $table->addColumn('name', 'string', [ |
|
| 640 | + 'notnull' => true, |
|
| 641 | + 'length' => 64, |
|
| 642 | + 'default' => '', |
|
| 643 | + ]); |
|
| 644 | + $table->addColumn('visibility', 'smallint', [ |
|
| 645 | + 'notnull' => true, |
|
| 646 | + 'length' => 1, |
|
| 647 | + 'default' => 1, |
|
| 648 | + ]); |
|
| 649 | + $table->addColumn('editable', 'smallint', [ |
|
| 650 | + 'notnull' => true, |
|
| 651 | + 'length' => 1, |
|
| 652 | + 'default' => 1, |
|
| 653 | + ]); |
|
| 654 | + $table->setPrimaryKey(['id']); |
|
| 655 | + $table->addUniqueIndex(['name', 'visibility', 'editable'], 'tag_ident'); |
|
| 656 | + } |
|
| 657 | + |
|
| 658 | + if (!$schema->hasTable('systemtag_object_mapping')) { |
|
| 659 | + $table = $schema->createTable('systemtag_object_mapping'); |
|
| 660 | + $table->addColumn('objectid', 'string', [ |
|
| 661 | + 'notnull' => true, |
|
| 662 | + 'length' => 64, |
|
| 663 | + 'default' => '', |
|
| 664 | + ]); |
|
| 665 | + $table->addColumn('objecttype', 'string', [ |
|
| 666 | + 'notnull' => true, |
|
| 667 | + 'length' => 64, |
|
| 668 | + 'default' => '', |
|
| 669 | + ]); |
|
| 670 | + $table->addColumn('systemtagid', 'integer', [ |
|
| 671 | + 'notnull' => true, |
|
| 672 | + 'length' => 4, |
|
| 673 | + 'default' => 0, |
|
| 674 | + 'unsigned' => true, |
|
| 675 | + ]); |
|
| 676 | + $table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk'); |
|
| 677 | 677 | // $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping'); |
| 678 | - } |
|
| 679 | - |
|
| 680 | - if (!$schema->hasTable('systemtag_group')) { |
|
| 681 | - $table = $schema->createTable('systemtag_group'); |
|
| 682 | - $table->addColumn('systemtagid', 'integer', [ |
|
| 683 | - 'notnull' => true, |
|
| 684 | - 'length' => 4, |
|
| 685 | - 'default' => 0, |
|
| 686 | - 'unsigned' => true, |
|
| 687 | - ]); |
|
| 688 | - $table->addColumn('gid', 'string', [ |
|
| 689 | - 'notnull' => true, |
|
| 690 | - ]); |
|
| 691 | - $table->setPrimaryKey(['gid', 'systemtagid']); |
|
| 692 | - } |
|
| 693 | - |
|
| 694 | - if (!$schema->hasTable('file_locks')) { |
|
| 695 | - $table = $schema->createTable('file_locks'); |
|
| 696 | - $table->addColumn('id', 'integer', [ |
|
| 697 | - 'autoincrement' => true, |
|
| 698 | - 'notnull' => true, |
|
| 699 | - 'length' => 4, |
|
| 700 | - 'unsigned' => true, |
|
| 701 | - ]); |
|
| 702 | - $table->addColumn('lock', 'integer', [ |
|
| 703 | - 'notnull' => true, |
|
| 704 | - 'length' => 4, |
|
| 705 | - 'default' => 0, |
|
| 706 | - ]); |
|
| 707 | - $table->addColumn('key', 'string', [ |
|
| 708 | - 'notnull' => true, |
|
| 709 | - 'length' => 64, |
|
| 710 | - ]); |
|
| 711 | - $table->addColumn('ttl', 'integer', [ |
|
| 712 | - 'notnull' => true, |
|
| 713 | - 'length' => 4, |
|
| 714 | - 'default' => -1, |
|
| 715 | - ]); |
|
| 716 | - $table->setPrimaryKey(['id']); |
|
| 717 | - $table->addUniqueIndex(['key'], 'lock_key_index'); |
|
| 718 | - $table->addIndex(['ttl'], 'lock_ttl_index'); |
|
| 719 | - } |
|
| 720 | - |
|
| 721 | - if (!$schema->hasTable('comments')) { |
|
| 722 | - $table = $schema->createTable('comments'); |
|
| 723 | - $table->addColumn('id', 'integer', [ |
|
| 724 | - 'autoincrement' => true, |
|
| 725 | - 'notnull' => true, |
|
| 726 | - 'length' => 4, |
|
| 727 | - 'unsigned' => true, |
|
| 728 | - ]); |
|
| 729 | - $table->addColumn('parent_id', 'integer', [ |
|
| 730 | - 'notnull' => true, |
|
| 731 | - 'length' => 4, |
|
| 732 | - 'default' => 0, |
|
| 733 | - 'unsigned' => true, |
|
| 734 | - ]); |
|
| 735 | - $table->addColumn('topmost_parent_id', 'integer', [ |
|
| 736 | - 'notnull' => true, |
|
| 737 | - 'length' => 4, |
|
| 738 | - 'default' => 0, |
|
| 739 | - 'unsigned' => true, |
|
| 740 | - ]); |
|
| 741 | - $table->addColumn('children_count', 'integer', [ |
|
| 742 | - 'notnull' => true, |
|
| 743 | - 'length' => 4, |
|
| 744 | - 'default' => 0, |
|
| 745 | - 'unsigned' => true, |
|
| 746 | - ]); |
|
| 747 | - $table->addColumn('actor_type', 'string', [ |
|
| 748 | - 'notnull' => true, |
|
| 749 | - 'length' => 64, |
|
| 750 | - 'default' => '', |
|
| 751 | - ]); |
|
| 752 | - $table->addColumn('actor_id', 'string', [ |
|
| 753 | - 'notnull' => true, |
|
| 754 | - 'length' => 64, |
|
| 755 | - 'default' => '', |
|
| 756 | - ]); |
|
| 757 | - $table->addColumn('message', 'text', [ |
|
| 758 | - 'notnull' => false, |
|
| 759 | - ]); |
|
| 760 | - $table->addColumn('verb', 'string', [ |
|
| 761 | - 'notnull' => false, |
|
| 762 | - 'length' => 64, |
|
| 763 | - ]); |
|
| 764 | - $table->addColumn('creation_timestamp', 'datetime', [ |
|
| 765 | - 'notnull' => false, |
|
| 766 | - ]); |
|
| 767 | - $table->addColumn('latest_child_timestamp', 'datetime', [ |
|
| 768 | - 'notnull' => false, |
|
| 769 | - ]); |
|
| 770 | - $table->addColumn('object_type', 'string', [ |
|
| 771 | - 'notnull' => true, |
|
| 772 | - 'length' => 64, |
|
| 773 | - 'default' => '', |
|
| 774 | - ]); |
|
| 775 | - $table->addColumn('object_id', 'string', [ |
|
| 776 | - 'notnull' => true, |
|
| 777 | - 'length' => 64, |
|
| 778 | - 'default' => '', |
|
| 779 | - ]); |
|
| 780 | - $table->addColumn('reference_id', 'string', [ |
|
| 781 | - 'notnull' => false, |
|
| 782 | - 'length' => 64, |
|
| 783 | - ]); |
|
| 784 | - $table->setPrimaryKey(['id']); |
|
| 785 | - $table->addIndex(['parent_id'], 'comments_parent_id_index'); |
|
| 786 | - $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); |
|
| 787 | - $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); |
|
| 788 | - $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); |
|
| 789 | - } |
|
| 790 | - |
|
| 791 | - if (!$schema->hasTable('comments_read_markers')) { |
|
| 792 | - $table = $schema->createTable('comments_read_markers'); |
|
| 793 | - $table->addColumn('user_id', 'string', [ |
|
| 794 | - 'notnull' => true, |
|
| 795 | - 'length' => 64, |
|
| 796 | - 'default' => '', |
|
| 797 | - ]); |
|
| 798 | - $table->addColumn('marker_datetime', 'datetime', [ |
|
| 799 | - 'notnull' => false, |
|
| 800 | - ]); |
|
| 801 | - $table->addColumn('object_type', 'string', [ |
|
| 802 | - 'notnull' => true, |
|
| 803 | - 'length' => 64, |
|
| 804 | - 'default' => '', |
|
| 805 | - ]); |
|
| 806 | - $table->addColumn('object_id', 'string', [ |
|
| 807 | - 'notnull' => true, |
|
| 808 | - 'length' => 64, |
|
| 809 | - 'default' => '', |
|
| 810 | - ]); |
|
| 811 | - $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); |
|
| 812 | - $table->setPrimaryKey(['user_id', 'object_type', 'object_id'], 'crm_pk'); |
|
| 678 | + } |
|
| 679 | + |
|
| 680 | + if (!$schema->hasTable('systemtag_group')) { |
|
| 681 | + $table = $schema->createTable('systemtag_group'); |
|
| 682 | + $table->addColumn('systemtagid', 'integer', [ |
|
| 683 | + 'notnull' => true, |
|
| 684 | + 'length' => 4, |
|
| 685 | + 'default' => 0, |
|
| 686 | + 'unsigned' => true, |
|
| 687 | + ]); |
|
| 688 | + $table->addColumn('gid', 'string', [ |
|
| 689 | + 'notnull' => true, |
|
| 690 | + ]); |
|
| 691 | + $table->setPrimaryKey(['gid', 'systemtagid']); |
|
| 692 | + } |
|
| 693 | + |
|
| 694 | + if (!$schema->hasTable('file_locks')) { |
|
| 695 | + $table = $schema->createTable('file_locks'); |
|
| 696 | + $table->addColumn('id', 'integer', [ |
|
| 697 | + 'autoincrement' => true, |
|
| 698 | + 'notnull' => true, |
|
| 699 | + 'length' => 4, |
|
| 700 | + 'unsigned' => true, |
|
| 701 | + ]); |
|
| 702 | + $table->addColumn('lock', 'integer', [ |
|
| 703 | + 'notnull' => true, |
|
| 704 | + 'length' => 4, |
|
| 705 | + 'default' => 0, |
|
| 706 | + ]); |
|
| 707 | + $table->addColumn('key', 'string', [ |
|
| 708 | + 'notnull' => true, |
|
| 709 | + 'length' => 64, |
|
| 710 | + ]); |
|
| 711 | + $table->addColumn('ttl', 'integer', [ |
|
| 712 | + 'notnull' => true, |
|
| 713 | + 'length' => 4, |
|
| 714 | + 'default' => -1, |
|
| 715 | + ]); |
|
| 716 | + $table->setPrimaryKey(['id']); |
|
| 717 | + $table->addUniqueIndex(['key'], 'lock_key_index'); |
|
| 718 | + $table->addIndex(['ttl'], 'lock_ttl_index'); |
|
| 719 | + } |
|
| 720 | + |
|
| 721 | + if (!$schema->hasTable('comments')) { |
|
| 722 | + $table = $schema->createTable('comments'); |
|
| 723 | + $table->addColumn('id', 'integer', [ |
|
| 724 | + 'autoincrement' => true, |
|
| 725 | + 'notnull' => true, |
|
| 726 | + 'length' => 4, |
|
| 727 | + 'unsigned' => true, |
|
| 728 | + ]); |
|
| 729 | + $table->addColumn('parent_id', 'integer', [ |
|
| 730 | + 'notnull' => true, |
|
| 731 | + 'length' => 4, |
|
| 732 | + 'default' => 0, |
|
| 733 | + 'unsigned' => true, |
|
| 734 | + ]); |
|
| 735 | + $table->addColumn('topmost_parent_id', 'integer', [ |
|
| 736 | + 'notnull' => true, |
|
| 737 | + 'length' => 4, |
|
| 738 | + 'default' => 0, |
|
| 739 | + 'unsigned' => true, |
|
| 740 | + ]); |
|
| 741 | + $table->addColumn('children_count', 'integer', [ |
|
| 742 | + 'notnull' => true, |
|
| 743 | + 'length' => 4, |
|
| 744 | + 'default' => 0, |
|
| 745 | + 'unsigned' => true, |
|
| 746 | + ]); |
|
| 747 | + $table->addColumn('actor_type', 'string', [ |
|
| 748 | + 'notnull' => true, |
|
| 749 | + 'length' => 64, |
|
| 750 | + 'default' => '', |
|
| 751 | + ]); |
|
| 752 | + $table->addColumn('actor_id', 'string', [ |
|
| 753 | + 'notnull' => true, |
|
| 754 | + 'length' => 64, |
|
| 755 | + 'default' => '', |
|
| 756 | + ]); |
|
| 757 | + $table->addColumn('message', 'text', [ |
|
| 758 | + 'notnull' => false, |
|
| 759 | + ]); |
|
| 760 | + $table->addColumn('verb', 'string', [ |
|
| 761 | + 'notnull' => false, |
|
| 762 | + 'length' => 64, |
|
| 763 | + ]); |
|
| 764 | + $table->addColumn('creation_timestamp', 'datetime', [ |
|
| 765 | + 'notnull' => false, |
|
| 766 | + ]); |
|
| 767 | + $table->addColumn('latest_child_timestamp', 'datetime', [ |
|
| 768 | + 'notnull' => false, |
|
| 769 | + ]); |
|
| 770 | + $table->addColumn('object_type', 'string', [ |
|
| 771 | + 'notnull' => true, |
|
| 772 | + 'length' => 64, |
|
| 773 | + 'default' => '', |
|
| 774 | + ]); |
|
| 775 | + $table->addColumn('object_id', 'string', [ |
|
| 776 | + 'notnull' => true, |
|
| 777 | + 'length' => 64, |
|
| 778 | + 'default' => '', |
|
| 779 | + ]); |
|
| 780 | + $table->addColumn('reference_id', 'string', [ |
|
| 781 | + 'notnull' => false, |
|
| 782 | + 'length' => 64, |
|
| 783 | + ]); |
|
| 784 | + $table->setPrimaryKey(['id']); |
|
| 785 | + $table->addIndex(['parent_id'], 'comments_parent_id_index'); |
|
| 786 | + $table->addIndex(['topmost_parent_id'], 'comments_topmost_parent_id_idx'); |
|
| 787 | + $table->addIndex(['object_type', 'object_id', 'creation_timestamp'], 'comments_object_index'); |
|
| 788 | + $table->addIndex(['actor_type', 'actor_id'], 'comments_actor_index'); |
|
| 789 | + } |
|
| 790 | + |
|
| 791 | + if (!$schema->hasTable('comments_read_markers')) { |
|
| 792 | + $table = $schema->createTable('comments_read_markers'); |
|
| 793 | + $table->addColumn('user_id', 'string', [ |
|
| 794 | + 'notnull' => true, |
|
| 795 | + 'length' => 64, |
|
| 796 | + 'default' => '', |
|
| 797 | + ]); |
|
| 798 | + $table->addColumn('marker_datetime', 'datetime', [ |
|
| 799 | + 'notnull' => false, |
|
| 800 | + ]); |
|
| 801 | + $table->addColumn('object_type', 'string', [ |
|
| 802 | + 'notnull' => true, |
|
| 803 | + 'length' => 64, |
|
| 804 | + 'default' => '', |
|
| 805 | + ]); |
|
| 806 | + $table->addColumn('object_id', 'string', [ |
|
| 807 | + 'notnull' => true, |
|
| 808 | + 'length' => 64, |
|
| 809 | + 'default' => '', |
|
| 810 | + ]); |
|
| 811 | + $table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index'); |
|
| 812 | + $table->setPrimaryKey(['user_id', 'object_type', 'object_id'], 'crm_pk'); |
|
| 813 | 813 | // $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index'); |
| 814 | - } |
|
| 814 | + } |
|
| 815 | 815 | |
| 816 | 816 | // if (!$schema->hasTable('credentials')) { |
| 817 | 817 | // $table = $schema->createTable('credentials'); |
@@ -830,111 +830,111 @@ discard block |
||
| 830 | 830 | // $table->addIndex(['user'], 'credentials_user'); |
| 831 | 831 | // } |
| 832 | 832 | |
| 833 | - if (!$schema->hasTable('admin_sections')) { |
|
| 834 | - $table = $schema->createTable('admin_sections'); |
|
| 835 | - $table->addColumn('id', 'string', [ |
|
| 836 | - 'notnull' => true, |
|
| 837 | - 'length' => 64, |
|
| 838 | - ]); |
|
| 839 | - $table->addColumn('class', 'string', [ |
|
| 840 | - 'notnull' => true, |
|
| 841 | - 'length' => 255, |
|
| 842 | - 'default' => '', |
|
| 843 | - ]); |
|
| 844 | - $table->addColumn('priority', 'smallint', [ |
|
| 845 | - 'notnull' => true, |
|
| 846 | - 'length' => 1, |
|
| 847 | - 'default' => 0, |
|
| 848 | - ]); |
|
| 849 | - $table->setPrimaryKey(['id']); |
|
| 850 | - $table->addUniqueIndex(['class'], 'admin_sections_class'); |
|
| 851 | - } |
|
| 852 | - |
|
| 853 | - if (!$schema->hasTable('admin_settings')) { |
|
| 854 | - $table = $schema->createTable('admin_settings'); |
|
| 855 | - $table->addColumn('id', 'integer', [ |
|
| 856 | - 'autoincrement' => true, |
|
| 857 | - 'notnull' => true, |
|
| 858 | - 'length' => 4, |
|
| 859 | - ]); |
|
| 860 | - $table->addColumn('class', 'string', [ |
|
| 861 | - 'notnull' => true, |
|
| 862 | - 'length' => 255, |
|
| 863 | - 'default' => '', |
|
| 864 | - ]); |
|
| 865 | - $table->addColumn('section', 'string', [ |
|
| 866 | - 'notnull' => false, |
|
| 867 | - 'length' => 64, |
|
| 868 | - ]); |
|
| 869 | - $table->addColumn('priority', 'smallint', [ |
|
| 870 | - 'notnull' => true, |
|
| 871 | - 'length' => 1, |
|
| 872 | - 'default' => 0, |
|
| 873 | - ]); |
|
| 874 | - $table->setPrimaryKey(['id']); |
|
| 875 | - $table->addUniqueIndex(['class'], 'admin_settings_class'); |
|
| 876 | - $table->addIndex(['section'], 'admin_settings_section'); |
|
| 877 | - } |
|
| 878 | - |
|
| 879 | - if (!$schema->hasTable('personal_sections')) { |
|
| 880 | - $table = $schema->createTable('personal_sections'); |
|
| 881 | - $table->addColumn('id', 'string', [ |
|
| 882 | - 'notnull' => true, |
|
| 883 | - 'length' => 64, |
|
| 884 | - ]); |
|
| 885 | - $table->addColumn('class', 'string', [ |
|
| 886 | - 'notnull' => true, |
|
| 887 | - 'length' => 255, |
|
| 888 | - 'default' => '', |
|
| 889 | - ]); |
|
| 890 | - $table->addColumn('priority', 'smallint', [ |
|
| 891 | - 'notnull' => true, |
|
| 892 | - 'length' => 1, |
|
| 893 | - 'default' => 0, |
|
| 894 | - ]); |
|
| 895 | - $table->setPrimaryKey(['id']); |
|
| 896 | - $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
| 897 | - } |
|
| 898 | - |
|
| 899 | - if (!$schema->hasTable('personal_settings')) { |
|
| 900 | - $table = $schema->createTable('personal_settings'); |
|
| 901 | - $table->addColumn('id', 'integer', [ |
|
| 902 | - 'autoincrement' => true, |
|
| 903 | - 'notnull' => true, |
|
| 904 | - 'length' => 4, |
|
| 905 | - ]); |
|
| 906 | - $table->addColumn('class', 'string', [ |
|
| 907 | - 'notnull' => true, |
|
| 908 | - 'length' => 255, |
|
| 909 | - 'default' => '', |
|
| 910 | - ]); |
|
| 911 | - $table->addColumn('section', 'string', [ |
|
| 912 | - 'notnull' => false, |
|
| 913 | - 'length' => 64, |
|
| 914 | - ]); |
|
| 915 | - $table->addColumn('priority', 'smallint', [ |
|
| 916 | - 'notnull' => true, |
|
| 917 | - 'length' => 1, |
|
| 918 | - 'default' => 0, |
|
| 919 | - ]); |
|
| 920 | - $table->setPrimaryKey(['id']); |
|
| 921 | - $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
| 922 | - $table->addIndex(['section'], 'personal_settings_section'); |
|
| 923 | - } |
|
| 924 | - |
|
| 925 | - if (!$schema->hasTable('accounts')) { |
|
| 926 | - $table = $schema->createTable('accounts'); |
|
| 927 | - $table->addColumn('uid', 'string', [ |
|
| 928 | - 'notnull' => true, |
|
| 929 | - 'length' => 64, |
|
| 930 | - 'default' => '', |
|
| 931 | - ]); |
|
| 932 | - $table->addColumn('data', 'text', [ |
|
| 933 | - 'notnull' => true, |
|
| 934 | - 'default' => '', |
|
| 935 | - ]); |
|
| 936 | - $table->setPrimaryKey(['uid']); |
|
| 937 | - } |
|
| 938 | - return $schema; |
|
| 939 | - } |
|
| 833 | + if (!$schema->hasTable('admin_sections')) { |
|
| 834 | + $table = $schema->createTable('admin_sections'); |
|
| 835 | + $table->addColumn('id', 'string', [ |
|
| 836 | + 'notnull' => true, |
|
| 837 | + 'length' => 64, |
|
| 838 | + ]); |
|
| 839 | + $table->addColumn('class', 'string', [ |
|
| 840 | + 'notnull' => true, |
|
| 841 | + 'length' => 255, |
|
| 842 | + 'default' => '', |
|
| 843 | + ]); |
|
| 844 | + $table->addColumn('priority', 'smallint', [ |
|
| 845 | + 'notnull' => true, |
|
| 846 | + 'length' => 1, |
|
| 847 | + 'default' => 0, |
|
| 848 | + ]); |
|
| 849 | + $table->setPrimaryKey(['id']); |
|
| 850 | + $table->addUniqueIndex(['class'], 'admin_sections_class'); |
|
| 851 | + } |
|
| 852 | + |
|
| 853 | + if (!$schema->hasTable('admin_settings')) { |
|
| 854 | + $table = $schema->createTable('admin_settings'); |
|
| 855 | + $table->addColumn('id', 'integer', [ |
|
| 856 | + 'autoincrement' => true, |
|
| 857 | + 'notnull' => true, |
|
| 858 | + 'length' => 4, |
|
| 859 | + ]); |
|
| 860 | + $table->addColumn('class', 'string', [ |
|
| 861 | + 'notnull' => true, |
|
| 862 | + 'length' => 255, |
|
| 863 | + 'default' => '', |
|
| 864 | + ]); |
|
| 865 | + $table->addColumn('section', 'string', [ |
|
| 866 | + 'notnull' => false, |
|
| 867 | + 'length' => 64, |
|
| 868 | + ]); |
|
| 869 | + $table->addColumn('priority', 'smallint', [ |
|
| 870 | + 'notnull' => true, |
|
| 871 | + 'length' => 1, |
|
| 872 | + 'default' => 0, |
|
| 873 | + ]); |
|
| 874 | + $table->setPrimaryKey(['id']); |
|
| 875 | + $table->addUniqueIndex(['class'], 'admin_settings_class'); |
|
| 876 | + $table->addIndex(['section'], 'admin_settings_section'); |
|
| 877 | + } |
|
| 878 | + |
|
| 879 | + if (!$schema->hasTable('personal_sections')) { |
|
| 880 | + $table = $schema->createTable('personal_sections'); |
|
| 881 | + $table->addColumn('id', 'string', [ |
|
| 882 | + 'notnull' => true, |
|
| 883 | + 'length' => 64, |
|
| 884 | + ]); |
|
| 885 | + $table->addColumn('class', 'string', [ |
|
| 886 | + 'notnull' => true, |
|
| 887 | + 'length' => 255, |
|
| 888 | + 'default' => '', |
|
| 889 | + ]); |
|
| 890 | + $table->addColumn('priority', 'smallint', [ |
|
| 891 | + 'notnull' => true, |
|
| 892 | + 'length' => 1, |
|
| 893 | + 'default' => 0, |
|
| 894 | + ]); |
|
| 895 | + $table->setPrimaryKey(['id']); |
|
| 896 | + $table->addUniqueIndex(['class'], 'personal_sections_class'); |
|
| 897 | + } |
|
| 898 | + |
|
| 899 | + if (!$schema->hasTable('personal_settings')) { |
|
| 900 | + $table = $schema->createTable('personal_settings'); |
|
| 901 | + $table->addColumn('id', 'integer', [ |
|
| 902 | + 'autoincrement' => true, |
|
| 903 | + 'notnull' => true, |
|
| 904 | + 'length' => 4, |
|
| 905 | + ]); |
|
| 906 | + $table->addColumn('class', 'string', [ |
|
| 907 | + 'notnull' => true, |
|
| 908 | + 'length' => 255, |
|
| 909 | + 'default' => '', |
|
| 910 | + ]); |
|
| 911 | + $table->addColumn('section', 'string', [ |
|
| 912 | + 'notnull' => false, |
|
| 913 | + 'length' => 64, |
|
| 914 | + ]); |
|
| 915 | + $table->addColumn('priority', 'smallint', [ |
|
| 916 | + 'notnull' => true, |
|
| 917 | + 'length' => 1, |
|
| 918 | + 'default' => 0, |
|
| 919 | + ]); |
|
| 920 | + $table->setPrimaryKey(['id']); |
|
| 921 | + $table->addUniqueIndex(['class'], 'personal_settings_class'); |
|
| 922 | + $table->addIndex(['section'], 'personal_settings_section'); |
|
| 923 | + } |
|
| 924 | + |
|
| 925 | + if (!$schema->hasTable('accounts')) { |
|
| 926 | + $table = $schema->createTable('accounts'); |
|
| 927 | + $table->addColumn('uid', 'string', [ |
|
| 928 | + 'notnull' => true, |
|
| 929 | + 'length' => 64, |
|
| 930 | + 'default' => '', |
|
| 931 | + ]); |
|
| 932 | + $table->addColumn('data', 'text', [ |
|
| 933 | + 'notnull' => true, |
|
| 934 | + 'default' => '', |
|
| 935 | + ]); |
|
| 936 | + $table->setPrimaryKey(['uid']); |
|
| 937 | + } |
|
| 938 | + return $schema; |
|
| 939 | + } |
|
| 940 | 940 | } |
@@ -32,34 +32,34 @@ |
||
| 32 | 32 | use OCP\Migration\SimpleMigrationStep; |
| 33 | 33 | |
| 34 | 34 | class Version20000Date20201109081915 extends SimpleMigrationStep { |
| 35 | - /** |
|
| 36 | - * @param IOutput $output |
|
| 37 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | - * @param array $options |
|
| 39 | - * @return null|ISchemaWrapper |
|
| 40 | - */ |
|
| 41 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 42 | - /** @var ISchemaWrapper $schema */ |
|
| 43 | - $schema = $schemaClosure(); |
|
| 35 | + /** |
|
| 36 | + * @param IOutput $output |
|
| 37 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 38 | + * @param array $options |
|
| 39 | + * @return null|ISchemaWrapper |
|
| 40 | + */ |
|
| 41 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 42 | + /** @var ISchemaWrapper $schema */ |
|
| 43 | + $schema = $schemaClosure(); |
|
| 44 | 44 | |
| 45 | - $result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk'); |
|
| 46 | - $result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result; |
|
| 45 | + $result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk'); |
|
| 46 | + $result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result; |
|
| 47 | 47 | // $result = $this->ensureColumnIsNullable($schema, 'credentials', 'user') || $result; |
| 48 | - $result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result; |
|
| 49 | - $result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result; |
|
| 48 | + $result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result; |
|
| 49 | + $result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result; |
|
| 50 | 50 | |
| 51 | - return $result ? $schema : null; |
|
| 52 | - } |
|
| 51 | + return $result ? $schema : null; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
| 55 | - $table = $schema->getTable($tableName); |
|
| 56 | - $column = $table->getColumn($columnName); |
|
| 54 | + protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { |
|
| 55 | + $table = $schema->getTable($tableName); |
|
| 56 | + $column = $table->getColumn($columnName); |
|
| 57 | 57 | |
| 58 | - if ($column->getNotnull()) { |
|
| 59 | - $column->setNotnull(false); |
|
| 60 | - return true; |
|
| 61 | - } |
|
| 58 | + if ($column->getNotnull()) { |
|
| 59 | + $column->setNotnull(false); |
|
| 60 | + return true; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return false; |
|
| 64 | - } |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -34,19 +34,19 @@ |
||
| 34 | 34 | use OCP\Migration\SimpleMigrationStep; |
| 35 | 35 | |
| 36 | 36 | class Version14000Date20180710092004 extends SimpleMigrationStep { |
| 37 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 38 | - /** @var ISchemaWrapper $schema */ |
|
| 39 | - $schema = $schemaClosure(); |
|
| 37 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 38 | + /** @var ISchemaWrapper $schema */ |
|
| 39 | + $schema = $schemaClosure(); |
|
| 40 | 40 | |
| 41 | - $table = $schema->getTable('share'); |
|
| 41 | + $table = $schema->getTable('share'); |
|
| 42 | 42 | |
| 43 | - if (!$table->hasColumn('password_by_talk')) { |
|
| 44 | - $table->addColumn('password_by_talk', Types::BOOLEAN, [ |
|
| 45 | - 'default' => 0, |
|
| 46 | - 'notnull' => false, |
|
| 47 | - ]); |
|
| 48 | - } |
|
| 43 | + if (!$table->hasColumn('password_by_talk')) { |
|
| 44 | + $table->addColumn('password_by_talk', Types::BOOLEAN, [ |
|
| 45 | + 'default' => 0, |
|
| 46 | + 'notnull' => false, |
|
| 47 | + ]); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $schema; |
|
| 51 | - } |
|
| 50 | + return $schema; |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -33,21 +33,21 @@ |
||
| 33 | 33 | |
| 34 | 34 | class Version20000Date20201109081919 extends SimpleMigrationStep { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - */ |
|
| 42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 43 | - /** @var ISchemaWrapper $schema */ |
|
| 44 | - $schema = $schemaClosure(); |
|
| 45 | - |
|
| 46 | - if ($schema->hasTable('credentials')) { |
|
| 47 | - $schema->dropTable('credentials'); |
|
| 48 | - return $schema; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - return null; |
|
| 52 | - } |
|
| 36 | + /** |
|
| 37 | + * @param IOutput $output |
|
| 38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | + * @param array $options |
|
| 40 | + * @return null|ISchemaWrapper |
|
| 41 | + */ |
|
| 42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 43 | + /** @var ISchemaWrapper $schema */ |
|
| 44 | + $schema = $schemaClosure(); |
|
| 45 | + |
|
| 46 | + if ($schema->hasTable('credentials')) { |
|
| 47 | + $schema->dropTable('credentials'); |
|
| 48 | + return $schema; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + return null; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -33,23 +33,23 @@ |
||
| 33 | 33 | |
| 34 | 34 | class Version15000Date20181015062942 extends SimpleMigrationStep { |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @param IOutput $output |
|
| 38 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | - * @param array $options |
|
| 40 | - * @return null|ISchemaWrapper |
|
| 41 | - */ |
|
| 42 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | - /** @var ISchemaWrapper $schema */ |
|
| 44 | - $schema = $schemaClosure(); |
|
| 45 | - |
|
| 46 | - $table = $schema->getTable('share'); |
|
| 47 | - $table->addColumn('hide_download', 'smallint', [ |
|
| 48 | - 'notnull' => false, |
|
| 49 | - 'length' => 1, |
|
| 50 | - 'default' => 0, |
|
| 51 | - ]); |
|
| 52 | - |
|
| 53 | - return $schema; |
|
| 54 | - } |
|
| 36 | + /** |
|
| 37 | + * @param IOutput $output |
|
| 38 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 39 | + * @param array $options |
|
| 40 | + * @return null|ISchemaWrapper |
|
| 41 | + */ |
|
| 42 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 43 | + /** @var ISchemaWrapper $schema */ |
|
| 44 | + $schema = $schemaClosure(); |
|
| 45 | + |
|
| 46 | + $table = $schema->getTable('share'); |
|
| 47 | + $table->addColumn('hide_download', 'smallint', [ |
|
| 48 | + 'notnull' => false, |
|
| 49 | + 'length' => 1, |
|
| 50 | + 'default' => 0, |
|
| 51 | + ]); |
|
| 52 | + |
|
| 53 | + return $schema; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -35,74 +35,74 @@ |
||
| 35 | 35 | |
| 36 | 36 | class Version20000Date20201109081918 extends SimpleMigrationStep { |
| 37 | 37 | |
| 38 | - /** @var IDBConnection */ |
|
| 39 | - protected $connection; |
|
| 38 | + /** @var IDBConnection */ |
|
| 39 | + protected $connection; |
|
| 40 | 40 | |
| 41 | - public function __construct(IDBConnection $connection) { |
|
| 42 | - $this->connection = $connection; |
|
| 43 | - } |
|
| 41 | + public function __construct(IDBConnection $connection) { |
|
| 42 | + $this->connection = $connection; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param IOutput $output |
|
| 47 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 48 | - * @param array $options |
|
| 49 | - * @return null|ISchemaWrapper |
|
| 50 | - */ |
|
| 51 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 52 | - /** @var ISchemaWrapper $schema */ |
|
| 53 | - $schema = $schemaClosure(); |
|
| 45 | + /** |
|
| 46 | + * @param IOutput $output |
|
| 47 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 48 | + * @param array $options |
|
| 49 | + * @return null|ISchemaWrapper |
|
| 50 | + */ |
|
| 51 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 52 | + /** @var ISchemaWrapper $schema */ |
|
| 53 | + $schema = $schemaClosure(); |
|
| 54 | 54 | |
| 55 | - $table = $schema->createTable('storages_credentials'); |
|
| 56 | - $table->addColumn('id', Type::BIGINT, [ |
|
| 57 | - 'autoincrement' => true, |
|
| 58 | - 'notnull' => true, |
|
| 59 | - 'length' => 64, |
|
| 60 | - ]); |
|
| 61 | - $table->addColumn('user', Type::STRING, [ |
|
| 62 | - 'notnull' => false, |
|
| 63 | - 'length' => 64, |
|
| 64 | - ]); |
|
| 65 | - $table->addColumn('identifier', Type::STRING, [ |
|
| 66 | - 'notnull' => true, |
|
| 67 | - 'length' => 64, |
|
| 68 | - ]); |
|
| 69 | - $table->addColumn('credentials', Type::TEXT, [ |
|
| 70 | - 'notnull' => false, |
|
| 71 | - ]); |
|
| 72 | - $table->setPrimaryKey(['id']); |
|
| 73 | - $table->addUniqueIndex(['user', 'identifier'], 'stocred_ui'); |
|
| 74 | - $table->addIndex(['user'], 'stocred_user'); |
|
| 55 | + $table = $schema->createTable('storages_credentials'); |
|
| 56 | + $table->addColumn('id', Type::BIGINT, [ |
|
| 57 | + 'autoincrement' => true, |
|
| 58 | + 'notnull' => true, |
|
| 59 | + 'length' => 64, |
|
| 60 | + ]); |
|
| 61 | + $table->addColumn('user', Type::STRING, [ |
|
| 62 | + 'notnull' => false, |
|
| 63 | + 'length' => 64, |
|
| 64 | + ]); |
|
| 65 | + $table->addColumn('identifier', Type::STRING, [ |
|
| 66 | + 'notnull' => true, |
|
| 67 | + 'length' => 64, |
|
| 68 | + ]); |
|
| 69 | + $table->addColumn('credentials', Type::TEXT, [ |
|
| 70 | + 'notnull' => false, |
|
| 71 | + ]); |
|
| 72 | + $table->setPrimaryKey(['id']); |
|
| 73 | + $table->addUniqueIndex(['user', 'identifier'], 'stocred_ui'); |
|
| 74 | + $table->addIndex(['user'], 'stocred_user'); |
|
| 75 | 75 | |
| 76 | - return $schema; |
|
| 77 | - } |
|
| 76 | + return $schema; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * {@inheritDoc} |
|
| 81 | - * |
|
| 82 | - * @since 13.0.0 |
|
| 83 | - */ |
|
| 84 | - public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { |
|
| 85 | - if (!$this->connection->tableExists('credentials')) { |
|
| 86 | - return; |
|
| 87 | - } |
|
| 79 | + /** |
|
| 80 | + * {@inheritDoc} |
|
| 81 | + * |
|
| 82 | + * @since 13.0.0 |
|
| 83 | + */ |
|
| 84 | + public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { |
|
| 85 | + if (!$this->connection->tableExists('credentials')) { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - $query = $this->connection->getQueryBuilder(); |
|
| 90 | - $query->select('*') |
|
| 91 | - ->from('credentials'); |
|
| 89 | + $query = $this->connection->getQueryBuilder(); |
|
| 90 | + $query->select('*') |
|
| 91 | + ->from('credentials'); |
|
| 92 | 92 | |
| 93 | - $insert = $this->connection->getQueryBuilder(); |
|
| 94 | - $insert->insert('storages_credentials') |
|
| 95 | - ->setValue('user', $insert->createNamedParameter('user')) |
|
| 96 | - ->setValue('identifier', $insert->createNamedParameter('identifier')) |
|
| 97 | - ->setValue('credentials', $insert->createNamedParameter('credentials')); |
|
| 93 | + $insert = $this->connection->getQueryBuilder(); |
|
| 94 | + $insert->insert('storages_credentials') |
|
| 95 | + ->setValue('user', $insert->createNamedParameter('user')) |
|
| 96 | + ->setValue('identifier', $insert->createNamedParameter('identifier')) |
|
| 97 | + ->setValue('credentials', $insert->createNamedParameter('credentials')); |
|
| 98 | 98 | |
| 99 | - $result = $query->execute(); |
|
| 100 | - while ($row = $result->fetch()) { |
|
| 101 | - $insert->setParameter('user', (string) $row['user']) |
|
| 102 | - ->setParameter('identifier', (string) $row['identifier']) |
|
| 103 | - ->setParameter('credentials', (string) $row['credentials']); |
|
| 104 | - $insert->execute(); |
|
| 105 | - } |
|
| 106 | - $result->closeCursor(); |
|
| 107 | - } |
|
| 99 | + $result = $query->execute(); |
|
| 100 | + while ($row = $result->fetch()) { |
|
| 101 | + $insert->setParameter('user', (string) $row['user']) |
|
| 102 | + ->setParameter('identifier', (string) $row['identifier']) |
|
| 103 | + ->setParameter('credentials', (string) $row['credentials']); |
|
| 104 | + $insert->execute(); |
|
| 105 | + } |
|
| 106 | + $result->closeCursor(); |
|
| 107 | + } |
|
| 108 | 108 | } |