@@ -14,49 +14,49 @@ |
||
| 14 | 14 | use OCP\Migration\SimpleMigrationStep; |
| 15 | 15 | |
| 16 | 16 | class Version21000Date20201120141228 extends SimpleMigrationStep { |
| 17 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 18 | - /** @var ISchemaWrapper $schema */ |
|
| 19 | - $schema = $schemaClosure(); |
|
| 20 | - |
|
| 21 | - if ($schema->hasTable('authtoken')) { |
|
| 22 | - $table = $schema->getTable('authtoken'); |
|
| 23 | - $loginNameColumn = $table->getColumn('login_name'); |
|
| 24 | - if ($loginNameColumn->getLength() !== 255) { |
|
| 25 | - $loginNameColumn->setLength(255); |
|
| 26 | - } |
|
| 27 | - $table->modifyColumn('type', [ |
|
| 28 | - 'notnull' => false, |
|
| 29 | - ]); |
|
| 30 | - $table->modifyColumn('remember', [ |
|
| 31 | - 'notnull' => false, |
|
| 32 | - ]); |
|
| 33 | - $table->modifyColumn('last_activity', [ |
|
| 34 | - 'notnull' => false, |
|
| 35 | - ]); |
|
| 36 | - $table->modifyColumn('last_check', [ |
|
| 37 | - 'notnull' => false, |
|
| 38 | - ]); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if ($schema->hasTable('dav_job_status')) { |
|
| 42 | - $schema->dropTable('dav_job_status'); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - if ($schema->hasTable('share')) { |
|
| 46 | - $table = $schema->getTable('share'); |
|
| 47 | - if ($table->hasColumn('attributes')) { |
|
| 48 | - $table->dropColumn('attributes'); |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - if ($schema->hasTable('jobs')) { |
|
| 53 | - $table = $schema->getTable('jobs'); |
|
| 54 | - $table->modifyColumn('execution_duration', [ |
|
| 55 | - 'notnull' => false, |
|
| 56 | - 'default' => 0, |
|
| 57 | - ]); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - return $schema; |
|
| 61 | - } |
|
| 17 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 18 | + /** @var ISchemaWrapper $schema */ |
|
| 19 | + $schema = $schemaClosure(); |
|
| 20 | + |
|
| 21 | + if ($schema->hasTable('authtoken')) { |
|
| 22 | + $table = $schema->getTable('authtoken'); |
|
| 23 | + $loginNameColumn = $table->getColumn('login_name'); |
|
| 24 | + if ($loginNameColumn->getLength() !== 255) { |
|
| 25 | + $loginNameColumn->setLength(255); |
|
| 26 | + } |
|
| 27 | + $table->modifyColumn('type', [ |
|
| 28 | + 'notnull' => false, |
|
| 29 | + ]); |
|
| 30 | + $table->modifyColumn('remember', [ |
|
| 31 | + 'notnull' => false, |
|
| 32 | + ]); |
|
| 33 | + $table->modifyColumn('last_activity', [ |
|
| 34 | + 'notnull' => false, |
|
| 35 | + ]); |
|
| 36 | + $table->modifyColumn('last_check', [ |
|
| 37 | + 'notnull' => false, |
|
| 38 | + ]); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if ($schema->hasTable('dav_job_status')) { |
|
| 42 | + $schema->dropTable('dav_job_status'); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + if ($schema->hasTable('share')) { |
|
| 46 | + $table = $schema->getTable('share'); |
|
| 47 | + if ($table->hasColumn('attributes')) { |
|
| 48 | + $table->dropColumn('attributes'); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + if ($schema->hasTable('jobs')) { |
|
| 53 | + $table = $schema->getTable('jobs'); |
|
| 54 | + $table->modifyColumn('execution_duration', [ |
|
| 55 | + 'notnull' => false, |
|
| 56 | + 'default' => 0, |
|
| 57 | + ]); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + return $schema; |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -15,23 +15,23 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Version2200Date20210805101925 extends SimpleMigrationStep { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @param IOutput $output |
|
| 20 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 21 | - * @param array $options |
|
| 22 | - * @return null|ISchemaWrapper |
|
| 23 | - */ |
|
| 24 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 25 | - /** @var ISchemaWrapper $schema */ |
|
| 26 | - $schema = $schemaClosure(); |
|
| 18 | + /** |
|
| 19 | + * @param IOutput $output |
|
| 20 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 21 | + * @param array $options |
|
| 22 | + * @return null|ISchemaWrapper |
|
| 23 | + */ |
|
| 24 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 25 | + /** @var ISchemaWrapper $schema */ |
|
| 26 | + $schema = $schemaClosure(); |
|
| 27 | 27 | |
| 28 | - if ($schema->hasTable('flow_operations')) { |
|
| 29 | - $table = $schema->getTable('flow_operations'); |
|
| 30 | - $table->modifyColumn('name', [ |
|
| 31 | - 'notnull' => false, |
|
| 32 | - ]); |
|
| 33 | - } |
|
| 28 | + if ($schema->hasTable('flow_operations')) { |
|
| 29 | + $table = $schema->getTable('flow_operations'); |
|
| 30 | + $table->modifyColumn('name', [ |
|
| 31 | + 'notnull' => false, |
|
| 32 | + ]); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - return $schema; |
|
| 36 | - } |
|
| 35 | + return $schema; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -11,471 +11,471 @@ |
||
| 11 | 11 | use OCP\Migration\SimpleMigrationStep; |
| 12 | 12 | |
| 13 | 13 | class Version1004Date20170825134824 extends SimpleMigrationStep { |
| 14 | - /** |
|
| 15 | - * @param IOutput $output |
|
| 16 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 17 | - * @param array $options |
|
| 18 | - * @return null|ISchemaWrapper |
|
| 19 | - * @since 13.0.0 |
|
| 20 | - */ |
|
| 21 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 22 | - /** @var ISchemaWrapper $schema */ |
|
| 23 | - $schema = $schemaClosure(); |
|
| 14 | + /** |
|
| 15 | + * @param IOutput $output |
|
| 16 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 17 | + * @param array $options |
|
| 18 | + * @return null|ISchemaWrapper |
|
| 19 | + * @since 13.0.0 |
|
| 20 | + */ |
|
| 21 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
| 22 | + /** @var ISchemaWrapper $schema */ |
|
| 23 | + $schema = $schemaClosure(); |
|
| 24 | 24 | |
| 25 | - if (!$schema->hasTable('addressbooks')) { |
|
| 26 | - $table = $schema->createTable('addressbooks'); |
|
| 27 | - $table->addColumn('id', 'bigint', [ |
|
| 28 | - 'autoincrement' => true, |
|
| 29 | - 'notnull' => true, |
|
| 30 | - 'length' => 11, |
|
| 31 | - 'unsigned' => true, |
|
| 32 | - ]); |
|
| 33 | - $table->addColumn('principaluri', 'string', [ |
|
| 34 | - 'notnull' => false, |
|
| 35 | - 'length' => 255, |
|
| 36 | - ]); |
|
| 37 | - $table->addColumn('displayname', 'string', [ |
|
| 38 | - 'notnull' => false, |
|
| 39 | - 'length' => 255, |
|
| 40 | - ]); |
|
| 41 | - $table->addColumn('uri', 'string', [ |
|
| 42 | - 'notnull' => false, |
|
| 43 | - 'length' => 255, |
|
| 44 | - ]); |
|
| 45 | - $table->addColumn('description', 'string', [ |
|
| 46 | - 'notnull' => false, |
|
| 47 | - 'length' => 255, |
|
| 48 | - ]); |
|
| 49 | - $table->addColumn('synctoken', 'integer', [ |
|
| 50 | - 'notnull' => true, |
|
| 51 | - 'default' => 1, |
|
| 52 | - 'length' => 10, |
|
| 53 | - 'unsigned' => true, |
|
| 54 | - ]); |
|
| 55 | - $table->setPrimaryKey(['id']); |
|
| 56 | - $table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index'); |
|
| 57 | - } |
|
| 25 | + if (!$schema->hasTable('addressbooks')) { |
|
| 26 | + $table = $schema->createTable('addressbooks'); |
|
| 27 | + $table->addColumn('id', 'bigint', [ |
|
| 28 | + 'autoincrement' => true, |
|
| 29 | + 'notnull' => true, |
|
| 30 | + 'length' => 11, |
|
| 31 | + 'unsigned' => true, |
|
| 32 | + ]); |
|
| 33 | + $table->addColumn('principaluri', 'string', [ |
|
| 34 | + 'notnull' => false, |
|
| 35 | + 'length' => 255, |
|
| 36 | + ]); |
|
| 37 | + $table->addColumn('displayname', 'string', [ |
|
| 38 | + 'notnull' => false, |
|
| 39 | + 'length' => 255, |
|
| 40 | + ]); |
|
| 41 | + $table->addColumn('uri', 'string', [ |
|
| 42 | + 'notnull' => false, |
|
| 43 | + 'length' => 255, |
|
| 44 | + ]); |
|
| 45 | + $table->addColumn('description', 'string', [ |
|
| 46 | + 'notnull' => false, |
|
| 47 | + 'length' => 255, |
|
| 48 | + ]); |
|
| 49 | + $table->addColumn('synctoken', 'integer', [ |
|
| 50 | + 'notnull' => true, |
|
| 51 | + 'default' => 1, |
|
| 52 | + 'length' => 10, |
|
| 53 | + 'unsigned' => true, |
|
| 54 | + ]); |
|
| 55 | + $table->setPrimaryKey(['id']); |
|
| 56 | + $table->addUniqueIndex(['principaluri', 'uri'], 'addressbook_index'); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - if (!$schema->hasTable('cards')) { |
|
| 60 | - $table = $schema->createTable('cards'); |
|
| 61 | - $table->addColumn('id', 'bigint', [ |
|
| 62 | - 'autoincrement' => true, |
|
| 63 | - 'notnull' => true, |
|
| 64 | - 'length' => 11, |
|
| 65 | - 'unsigned' => true, |
|
| 66 | - ]); |
|
| 67 | - $table->addColumn('addressbookid', 'integer', [ |
|
| 68 | - 'notnull' => true, |
|
| 69 | - 'default' => 0, |
|
| 70 | - ]); |
|
| 71 | - $table->addColumn('carddata', 'blob', [ |
|
| 72 | - 'notnull' => false, |
|
| 73 | - ]); |
|
| 74 | - $table->addColumn('uri', 'string', [ |
|
| 75 | - 'notnull' => false, |
|
| 76 | - 'length' => 255, |
|
| 77 | - ]); |
|
| 78 | - $table->addColumn('lastmodified', 'bigint', [ |
|
| 79 | - 'notnull' => false, |
|
| 80 | - 'length' => 11, |
|
| 81 | - 'unsigned' => true, |
|
| 82 | - ]); |
|
| 83 | - $table->addColumn('etag', 'string', [ |
|
| 84 | - 'notnull' => false, |
|
| 85 | - 'length' => 32, |
|
| 86 | - ]); |
|
| 87 | - $table->addColumn('size', 'bigint', [ |
|
| 88 | - 'notnull' => true, |
|
| 89 | - 'length' => 11, |
|
| 90 | - 'unsigned' => true, |
|
| 91 | - ]); |
|
| 92 | - $table->setPrimaryKey(['id']); |
|
| 93 | - } |
|
| 59 | + if (!$schema->hasTable('cards')) { |
|
| 60 | + $table = $schema->createTable('cards'); |
|
| 61 | + $table->addColumn('id', 'bigint', [ |
|
| 62 | + 'autoincrement' => true, |
|
| 63 | + 'notnull' => true, |
|
| 64 | + 'length' => 11, |
|
| 65 | + 'unsigned' => true, |
|
| 66 | + ]); |
|
| 67 | + $table->addColumn('addressbookid', 'integer', [ |
|
| 68 | + 'notnull' => true, |
|
| 69 | + 'default' => 0, |
|
| 70 | + ]); |
|
| 71 | + $table->addColumn('carddata', 'blob', [ |
|
| 72 | + 'notnull' => false, |
|
| 73 | + ]); |
|
| 74 | + $table->addColumn('uri', 'string', [ |
|
| 75 | + 'notnull' => false, |
|
| 76 | + 'length' => 255, |
|
| 77 | + ]); |
|
| 78 | + $table->addColumn('lastmodified', 'bigint', [ |
|
| 79 | + 'notnull' => false, |
|
| 80 | + 'length' => 11, |
|
| 81 | + 'unsigned' => true, |
|
| 82 | + ]); |
|
| 83 | + $table->addColumn('etag', 'string', [ |
|
| 84 | + 'notnull' => false, |
|
| 85 | + 'length' => 32, |
|
| 86 | + ]); |
|
| 87 | + $table->addColumn('size', 'bigint', [ |
|
| 88 | + 'notnull' => true, |
|
| 89 | + 'length' => 11, |
|
| 90 | + 'unsigned' => true, |
|
| 91 | + ]); |
|
| 92 | + $table->setPrimaryKey(['id']); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - if (!$schema->hasTable('addressbookchanges')) { |
|
| 96 | - $table = $schema->createTable('addressbookchanges'); |
|
| 97 | - $table->addColumn('id', 'bigint', [ |
|
| 98 | - 'autoincrement' => true, |
|
| 99 | - 'notnull' => true, |
|
| 100 | - 'length' => 11, |
|
| 101 | - 'unsigned' => true, |
|
| 102 | - ]); |
|
| 103 | - $table->addColumn('uri', 'string', [ |
|
| 104 | - 'notnull' => false, |
|
| 105 | - 'length' => 255, |
|
| 106 | - ]); |
|
| 107 | - $table->addColumn('synctoken', 'integer', [ |
|
| 108 | - 'notnull' => true, |
|
| 109 | - 'default' => 1, |
|
| 110 | - 'length' => 10, |
|
| 111 | - 'unsigned' => true, |
|
| 112 | - ]); |
|
| 113 | - $table->addColumn('addressbookid', 'integer', [ |
|
| 114 | - 'notnull' => true, |
|
| 115 | - ]); |
|
| 116 | - $table->addColumn('operation', 'smallint', [ |
|
| 117 | - 'notnull' => true, |
|
| 118 | - 'length' => 1, |
|
| 119 | - ]); |
|
| 120 | - $table->setPrimaryKey(['id']); |
|
| 121 | - $table->addIndex(['addressbookid', 'synctoken'], 'addressbookid_synctoken'); |
|
| 122 | - } |
|
| 95 | + if (!$schema->hasTable('addressbookchanges')) { |
|
| 96 | + $table = $schema->createTable('addressbookchanges'); |
|
| 97 | + $table->addColumn('id', 'bigint', [ |
|
| 98 | + 'autoincrement' => true, |
|
| 99 | + 'notnull' => true, |
|
| 100 | + 'length' => 11, |
|
| 101 | + 'unsigned' => true, |
|
| 102 | + ]); |
|
| 103 | + $table->addColumn('uri', 'string', [ |
|
| 104 | + 'notnull' => false, |
|
| 105 | + 'length' => 255, |
|
| 106 | + ]); |
|
| 107 | + $table->addColumn('synctoken', 'integer', [ |
|
| 108 | + 'notnull' => true, |
|
| 109 | + 'default' => 1, |
|
| 110 | + 'length' => 10, |
|
| 111 | + 'unsigned' => true, |
|
| 112 | + ]); |
|
| 113 | + $table->addColumn('addressbookid', 'integer', [ |
|
| 114 | + 'notnull' => true, |
|
| 115 | + ]); |
|
| 116 | + $table->addColumn('operation', 'smallint', [ |
|
| 117 | + 'notnull' => true, |
|
| 118 | + 'length' => 1, |
|
| 119 | + ]); |
|
| 120 | + $table->setPrimaryKey(['id']); |
|
| 121 | + $table->addIndex(['addressbookid', 'synctoken'], 'addressbookid_synctoken'); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - if (!$schema->hasTable('calendarobjects')) { |
|
| 125 | - $table = $schema->createTable('calendarobjects'); |
|
| 126 | - $table->addColumn('id', 'bigint', [ |
|
| 127 | - 'autoincrement' => true, |
|
| 128 | - 'notnull' => true, |
|
| 129 | - 'length' => 11, |
|
| 130 | - 'unsigned' => true, |
|
| 131 | - ]); |
|
| 132 | - $table->addColumn('calendardata', 'blob', [ |
|
| 133 | - 'notnull' => false, |
|
| 134 | - ]); |
|
| 135 | - $table->addColumn('uri', 'string', [ |
|
| 136 | - 'notnull' => false, |
|
| 137 | - 'length' => 255, |
|
| 138 | - ]); |
|
| 139 | - $table->addColumn('calendarid', 'integer', [ |
|
| 140 | - 'notnull' => true, |
|
| 141 | - 'length' => 10, |
|
| 142 | - 'unsigned' => true, |
|
| 143 | - ]); |
|
| 144 | - $table->addColumn('lastmodified', 'integer', [ |
|
| 145 | - 'notnull' => false, |
|
| 146 | - 'length' => 10, |
|
| 147 | - 'unsigned' => true, |
|
| 148 | - ]); |
|
| 149 | - $table->addColumn('etag', 'string', [ |
|
| 150 | - 'notnull' => false, |
|
| 151 | - 'length' => 32, |
|
| 152 | - ]); |
|
| 153 | - $table->addColumn('size', 'bigint', [ |
|
| 154 | - 'notnull' => true, |
|
| 155 | - 'length' => 11, |
|
| 156 | - 'unsigned' => true, |
|
| 157 | - ]); |
|
| 158 | - $table->addColumn('componenttype', 'string', [ |
|
| 159 | - 'notnull' => false, |
|
| 160 | - 'length' => 8, |
|
| 161 | - ]); |
|
| 162 | - $table->addColumn('firstoccurence', 'bigint', [ |
|
| 163 | - 'notnull' => false, |
|
| 164 | - 'length' => 11, |
|
| 165 | - 'unsigned' => true, |
|
| 166 | - ]); |
|
| 167 | - $table->addColumn('lastoccurence', 'bigint', [ |
|
| 168 | - 'notnull' => false, |
|
| 169 | - 'length' => 11, |
|
| 170 | - 'unsigned' => true, |
|
| 171 | - ]); |
|
| 172 | - $table->addColumn('uid', 'string', [ |
|
| 173 | - 'notnull' => false, |
|
| 174 | - 'length' => 255, |
|
| 175 | - ]); |
|
| 176 | - $table->addColumn('classification', 'integer', [ |
|
| 177 | - 'notnull' => false, |
|
| 178 | - 'default' => 0, |
|
| 179 | - ]); |
|
| 180 | - $table->setPrimaryKey(['id']); |
|
| 181 | - $table->addUniqueIndex(['calendarid', 'uri'], 'calobjects_index'); |
|
| 182 | - } |
|
| 124 | + if (!$schema->hasTable('calendarobjects')) { |
|
| 125 | + $table = $schema->createTable('calendarobjects'); |
|
| 126 | + $table->addColumn('id', 'bigint', [ |
|
| 127 | + 'autoincrement' => true, |
|
| 128 | + 'notnull' => true, |
|
| 129 | + 'length' => 11, |
|
| 130 | + 'unsigned' => true, |
|
| 131 | + ]); |
|
| 132 | + $table->addColumn('calendardata', 'blob', [ |
|
| 133 | + 'notnull' => false, |
|
| 134 | + ]); |
|
| 135 | + $table->addColumn('uri', 'string', [ |
|
| 136 | + 'notnull' => false, |
|
| 137 | + 'length' => 255, |
|
| 138 | + ]); |
|
| 139 | + $table->addColumn('calendarid', 'integer', [ |
|
| 140 | + 'notnull' => true, |
|
| 141 | + 'length' => 10, |
|
| 142 | + 'unsigned' => true, |
|
| 143 | + ]); |
|
| 144 | + $table->addColumn('lastmodified', 'integer', [ |
|
| 145 | + 'notnull' => false, |
|
| 146 | + 'length' => 10, |
|
| 147 | + 'unsigned' => true, |
|
| 148 | + ]); |
|
| 149 | + $table->addColumn('etag', 'string', [ |
|
| 150 | + 'notnull' => false, |
|
| 151 | + 'length' => 32, |
|
| 152 | + ]); |
|
| 153 | + $table->addColumn('size', 'bigint', [ |
|
| 154 | + 'notnull' => true, |
|
| 155 | + 'length' => 11, |
|
| 156 | + 'unsigned' => true, |
|
| 157 | + ]); |
|
| 158 | + $table->addColumn('componenttype', 'string', [ |
|
| 159 | + 'notnull' => false, |
|
| 160 | + 'length' => 8, |
|
| 161 | + ]); |
|
| 162 | + $table->addColumn('firstoccurence', 'bigint', [ |
|
| 163 | + 'notnull' => false, |
|
| 164 | + 'length' => 11, |
|
| 165 | + 'unsigned' => true, |
|
| 166 | + ]); |
|
| 167 | + $table->addColumn('lastoccurence', 'bigint', [ |
|
| 168 | + 'notnull' => false, |
|
| 169 | + 'length' => 11, |
|
| 170 | + 'unsigned' => true, |
|
| 171 | + ]); |
|
| 172 | + $table->addColumn('uid', 'string', [ |
|
| 173 | + 'notnull' => false, |
|
| 174 | + 'length' => 255, |
|
| 175 | + ]); |
|
| 176 | + $table->addColumn('classification', 'integer', [ |
|
| 177 | + 'notnull' => false, |
|
| 178 | + 'default' => 0, |
|
| 179 | + ]); |
|
| 180 | + $table->setPrimaryKey(['id']); |
|
| 181 | + $table->addUniqueIndex(['calendarid', 'uri'], 'calobjects_index'); |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - if (!$schema->hasTable('calendars')) { |
|
| 185 | - $table = $schema->createTable('calendars'); |
|
| 186 | - $table->addColumn('id', 'bigint', [ |
|
| 187 | - 'autoincrement' => true, |
|
| 188 | - 'notnull' => true, |
|
| 189 | - 'length' => 11, |
|
| 190 | - 'unsigned' => true, |
|
| 191 | - ]); |
|
| 192 | - $table->addColumn('principaluri', 'string', [ |
|
| 193 | - 'notnull' => false, |
|
| 194 | - 'length' => 255, |
|
| 195 | - ]); |
|
| 196 | - $table->addColumn('displayname', 'string', [ |
|
| 197 | - 'notnull' => false, |
|
| 198 | - 'length' => 255, |
|
| 199 | - ]); |
|
| 200 | - $table->addColumn('uri', 'string', [ |
|
| 201 | - 'notnull' => false, |
|
| 202 | - 'length' => 255, |
|
| 203 | - ]); |
|
| 204 | - $table->addColumn('synctoken', 'integer', [ |
|
| 205 | - 'notnull' => true, |
|
| 206 | - 'default' => 1, |
|
| 207 | - 'unsigned' => true, |
|
| 208 | - ]); |
|
| 209 | - $table->addColumn('description', 'string', [ |
|
| 210 | - 'notnull' => false, |
|
| 211 | - 'length' => 255, |
|
| 212 | - ]); |
|
| 213 | - $table->addColumn('calendarorder', 'integer', [ |
|
| 214 | - 'notnull' => true, |
|
| 215 | - 'default' => 0, |
|
| 216 | - 'unsigned' => true, |
|
| 217 | - ]); |
|
| 218 | - $table->addColumn('calendarcolor', 'string', [ |
|
| 219 | - 'notnull' => false, |
|
| 220 | - ]); |
|
| 221 | - $table->addColumn('timezone', 'text', [ |
|
| 222 | - 'notnull' => false, |
|
| 223 | - ]); |
|
| 224 | - $table->addColumn('components', 'string', [ |
|
| 225 | - 'notnull' => false, |
|
| 226 | - 'length' => 64, |
|
| 227 | - ]); |
|
| 228 | - $table->addColumn('transparent', 'smallint', [ |
|
| 229 | - 'notnull' => true, |
|
| 230 | - 'length' => 1, |
|
| 231 | - 'default' => 0, |
|
| 232 | - ]); |
|
| 233 | - $table->setPrimaryKey(['id']); |
|
| 234 | - $table->addUniqueIndex(['principaluri', 'uri'], 'calendars_index'); |
|
| 235 | - } else { |
|
| 236 | - $table = $schema->getTable('calendars'); |
|
| 237 | - $table->modifyColumn('components', [ |
|
| 238 | - 'notnull' => false, |
|
| 239 | - 'length' => 64, |
|
| 240 | - ]); |
|
| 241 | - } |
|
| 184 | + if (!$schema->hasTable('calendars')) { |
|
| 185 | + $table = $schema->createTable('calendars'); |
|
| 186 | + $table->addColumn('id', 'bigint', [ |
|
| 187 | + 'autoincrement' => true, |
|
| 188 | + 'notnull' => true, |
|
| 189 | + 'length' => 11, |
|
| 190 | + 'unsigned' => true, |
|
| 191 | + ]); |
|
| 192 | + $table->addColumn('principaluri', 'string', [ |
|
| 193 | + 'notnull' => false, |
|
| 194 | + 'length' => 255, |
|
| 195 | + ]); |
|
| 196 | + $table->addColumn('displayname', 'string', [ |
|
| 197 | + 'notnull' => false, |
|
| 198 | + 'length' => 255, |
|
| 199 | + ]); |
|
| 200 | + $table->addColumn('uri', 'string', [ |
|
| 201 | + 'notnull' => false, |
|
| 202 | + 'length' => 255, |
|
| 203 | + ]); |
|
| 204 | + $table->addColumn('synctoken', 'integer', [ |
|
| 205 | + 'notnull' => true, |
|
| 206 | + 'default' => 1, |
|
| 207 | + 'unsigned' => true, |
|
| 208 | + ]); |
|
| 209 | + $table->addColumn('description', 'string', [ |
|
| 210 | + 'notnull' => false, |
|
| 211 | + 'length' => 255, |
|
| 212 | + ]); |
|
| 213 | + $table->addColumn('calendarorder', 'integer', [ |
|
| 214 | + 'notnull' => true, |
|
| 215 | + 'default' => 0, |
|
| 216 | + 'unsigned' => true, |
|
| 217 | + ]); |
|
| 218 | + $table->addColumn('calendarcolor', 'string', [ |
|
| 219 | + 'notnull' => false, |
|
| 220 | + ]); |
|
| 221 | + $table->addColumn('timezone', 'text', [ |
|
| 222 | + 'notnull' => false, |
|
| 223 | + ]); |
|
| 224 | + $table->addColumn('components', 'string', [ |
|
| 225 | + 'notnull' => false, |
|
| 226 | + 'length' => 64, |
|
| 227 | + ]); |
|
| 228 | + $table->addColumn('transparent', 'smallint', [ |
|
| 229 | + 'notnull' => true, |
|
| 230 | + 'length' => 1, |
|
| 231 | + 'default' => 0, |
|
| 232 | + ]); |
|
| 233 | + $table->setPrimaryKey(['id']); |
|
| 234 | + $table->addUniqueIndex(['principaluri', 'uri'], 'calendars_index'); |
|
| 235 | + } else { |
|
| 236 | + $table = $schema->getTable('calendars'); |
|
| 237 | + $table->modifyColumn('components', [ |
|
| 238 | + 'notnull' => false, |
|
| 239 | + 'length' => 64, |
|
| 240 | + ]); |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - if (!$schema->hasTable('calendarchanges')) { |
|
| 244 | - $table = $schema->createTable('calendarchanges'); |
|
| 245 | - $table->addColumn('id', 'bigint', [ |
|
| 246 | - 'autoincrement' => true, |
|
| 247 | - 'notnull' => true, |
|
| 248 | - 'length' => 11, |
|
| 249 | - 'unsigned' => true, |
|
| 250 | - ]); |
|
| 251 | - $table->addColumn('uri', 'string', [ |
|
| 252 | - 'notnull' => false, |
|
| 253 | - 'length' => 255, |
|
| 254 | - ]); |
|
| 255 | - $table->addColumn('synctoken', 'integer', [ |
|
| 256 | - 'notnull' => true, |
|
| 257 | - 'default' => 1, |
|
| 258 | - 'length' => 10, |
|
| 259 | - 'unsigned' => true, |
|
| 260 | - ]); |
|
| 261 | - $table->addColumn('calendarid', 'integer', [ |
|
| 262 | - 'notnull' => true, |
|
| 263 | - ]); |
|
| 264 | - $table->addColumn('operation', 'smallint', [ |
|
| 265 | - 'notnull' => true, |
|
| 266 | - 'length' => 1, |
|
| 267 | - ]); |
|
| 268 | - $table->setPrimaryKey(['id']); |
|
| 269 | - $table->addIndex(['calendarid', 'synctoken'], 'calendarid_synctoken'); |
|
| 270 | - } |
|
| 243 | + if (!$schema->hasTable('calendarchanges')) { |
|
| 244 | + $table = $schema->createTable('calendarchanges'); |
|
| 245 | + $table->addColumn('id', 'bigint', [ |
|
| 246 | + 'autoincrement' => true, |
|
| 247 | + 'notnull' => true, |
|
| 248 | + 'length' => 11, |
|
| 249 | + 'unsigned' => true, |
|
| 250 | + ]); |
|
| 251 | + $table->addColumn('uri', 'string', [ |
|
| 252 | + 'notnull' => false, |
|
| 253 | + 'length' => 255, |
|
| 254 | + ]); |
|
| 255 | + $table->addColumn('synctoken', 'integer', [ |
|
| 256 | + 'notnull' => true, |
|
| 257 | + 'default' => 1, |
|
| 258 | + 'length' => 10, |
|
| 259 | + 'unsigned' => true, |
|
| 260 | + ]); |
|
| 261 | + $table->addColumn('calendarid', 'integer', [ |
|
| 262 | + 'notnull' => true, |
|
| 263 | + ]); |
|
| 264 | + $table->addColumn('operation', 'smallint', [ |
|
| 265 | + 'notnull' => true, |
|
| 266 | + 'length' => 1, |
|
| 267 | + ]); |
|
| 268 | + $table->setPrimaryKey(['id']); |
|
| 269 | + $table->addIndex(['calendarid', 'synctoken'], 'calendarid_synctoken'); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - if (!$schema->hasTable('calendarsubscriptions')) { |
|
| 273 | - $table = $schema->createTable('calendarsubscriptions'); |
|
| 274 | - $table->addColumn('id', 'bigint', [ |
|
| 275 | - 'autoincrement' => true, |
|
| 276 | - 'notnull' => true, |
|
| 277 | - 'length' => 11, |
|
| 278 | - 'unsigned' => true, |
|
| 279 | - ]); |
|
| 280 | - $table->addColumn('uri', 'string', [ |
|
| 281 | - 'notnull' => false, |
|
| 282 | - ]); |
|
| 283 | - $table->addColumn('principaluri', 'string', [ |
|
| 284 | - 'notnull' => false, |
|
| 285 | - 'length' => 255, |
|
| 286 | - ]); |
|
| 287 | - $table->addColumn('source', 'string', [ |
|
| 288 | - 'notnull' => false, |
|
| 289 | - 'length' => 255, |
|
| 290 | - ]); |
|
| 291 | - $table->addColumn('displayname', 'string', [ |
|
| 292 | - 'notnull' => false, |
|
| 293 | - 'length' => 100, |
|
| 294 | - ]); |
|
| 295 | - $table->addColumn('refreshrate', 'string', [ |
|
| 296 | - 'notnull' => false, |
|
| 297 | - 'length' => 10, |
|
| 298 | - ]); |
|
| 299 | - $table->addColumn('calendarorder', 'integer', [ |
|
| 300 | - 'notnull' => true, |
|
| 301 | - 'default' => 0, |
|
| 302 | - 'unsigned' => true, |
|
| 303 | - ]); |
|
| 304 | - $table->addColumn('calendarcolor', 'string', [ |
|
| 305 | - 'notnull' => false, |
|
| 306 | - ]); |
|
| 307 | - $table->addColumn('striptodos', 'smallint', [ |
|
| 308 | - 'notnull' => false, |
|
| 309 | - 'length' => 1, |
|
| 310 | - ]); |
|
| 311 | - $table->addColumn('stripalarms', 'smallint', [ |
|
| 312 | - 'notnull' => false, |
|
| 313 | - 'length' => 1, |
|
| 314 | - ]); |
|
| 315 | - $table->addColumn('stripattachments', 'smallint', [ |
|
| 316 | - 'notnull' => false, |
|
| 317 | - 'length' => 1, |
|
| 318 | - ]); |
|
| 319 | - $table->addColumn('lastmodified', 'integer', [ |
|
| 320 | - 'notnull' => false, |
|
| 321 | - 'unsigned' => true, |
|
| 322 | - ]); |
|
| 323 | - $table->setPrimaryKey(['id']); |
|
| 324 | - $table->addUniqueIndex(['principaluri', 'uri'], 'calsub_index'); |
|
| 325 | - } else { |
|
| 326 | - $table = $schema->getTable('calendarsubscriptions'); |
|
| 327 | - $table->modifyColumn('lastmodified', [ |
|
| 328 | - 'notnull' => false, |
|
| 329 | - 'unsigned' => true, |
|
| 330 | - ]); |
|
| 331 | - } |
|
| 272 | + if (!$schema->hasTable('calendarsubscriptions')) { |
|
| 273 | + $table = $schema->createTable('calendarsubscriptions'); |
|
| 274 | + $table->addColumn('id', 'bigint', [ |
|
| 275 | + 'autoincrement' => true, |
|
| 276 | + 'notnull' => true, |
|
| 277 | + 'length' => 11, |
|
| 278 | + 'unsigned' => true, |
|
| 279 | + ]); |
|
| 280 | + $table->addColumn('uri', 'string', [ |
|
| 281 | + 'notnull' => false, |
|
| 282 | + ]); |
|
| 283 | + $table->addColumn('principaluri', 'string', [ |
|
| 284 | + 'notnull' => false, |
|
| 285 | + 'length' => 255, |
|
| 286 | + ]); |
|
| 287 | + $table->addColumn('source', 'string', [ |
|
| 288 | + 'notnull' => false, |
|
| 289 | + 'length' => 255, |
|
| 290 | + ]); |
|
| 291 | + $table->addColumn('displayname', 'string', [ |
|
| 292 | + 'notnull' => false, |
|
| 293 | + 'length' => 100, |
|
| 294 | + ]); |
|
| 295 | + $table->addColumn('refreshrate', 'string', [ |
|
| 296 | + 'notnull' => false, |
|
| 297 | + 'length' => 10, |
|
| 298 | + ]); |
|
| 299 | + $table->addColumn('calendarorder', 'integer', [ |
|
| 300 | + 'notnull' => true, |
|
| 301 | + 'default' => 0, |
|
| 302 | + 'unsigned' => true, |
|
| 303 | + ]); |
|
| 304 | + $table->addColumn('calendarcolor', 'string', [ |
|
| 305 | + 'notnull' => false, |
|
| 306 | + ]); |
|
| 307 | + $table->addColumn('striptodos', 'smallint', [ |
|
| 308 | + 'notnull' => false, |
|
| 309 | + 'length' => 1, |
|
| 310 | + ]); |
|
| 311 | + $table->addColumn('stripalarms', 'smallint', [ |
|
| 312 | + 'notnull' => false, |
|
| 313 | + 'length' => 1, |
|
| 314 | + ]); |
|
| 315 | + $table->addColumn('stripattachments', 'smallint', [ |
|
| 316 | + 'notnull' => false, |
|
| 317 | + 'length' => 1, |
|
| 318 | + ]); |
|
| 319 | + $table->addColumn('lastmodified', 'integer', [ |
|
| 320 | + 'notnull' => false, |
|
| 321 | + 'unsigned' => true, |
|
| 322 | + ]); |
|
| 323 | + $table->setPrimaryKey(['id']); |
|
| 324 | + $table->addUniqueIndex(['principaluri', 'uri'], 'calsub_index'); |
|
| 325 | + } else { |
|
| 326 | + $table = $schema->getTable('calendarsubscriptions'); |
|
| 327 | + $table->modifyColumn('lastmodified', [ |
|
| 328 | + 'notnull' => false, |
|
| 329 | + 'unsigned' => true, |
|
| 330 | + ]); |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - if (!$schema->hasTable('schedulingobjects')) { |
|
| 334 | - $table = $schema->createTable('schedulingobjects'); |
|
| 335 | - $table->addColumn('id', 'bigint', [ |
|
| 336 | - 'autoincrement' => true, |
|
| 337 | - 'notnull' => true, |
|
| 338 | - 'length' => 11, |
|
| 339 | - 'unsigned' => true, |
|
| 340 | - ]); |
|
| 341 | - $table->addColumn('principaluri', 'string', [ |
|
| 342 | - 'notnull' => false, |
|
| 343 | - 'length' => 255, |
|
| 344 | - ]); |
|
| 345 | - $table->addColumn('calendardata', 'blob', [ |
|
| 346 | - 'notnull' => false, |
|
| 347 | - ]); |
|
| 348 | - $table->addColumn('uri', 'string', [ |
|
| 349 | - 'notnull' => false, |
|
| 350 | - 'length' => 255, |
|
| 351 | - ]); |
|
| 352 | - $table->addColumn('lastmodified', 'integer', [ |
|
| 353 | - 'notnull' => false, |
|
| 354 | - 'unsigned' => true, |
|
| 355 | - ]); |
|
| 356 | - $table->addColumn('etag', 'string', [ |
|
| 357 | - 'notnull' => false, |
|
| 358 | - 'length' => 32, |
|
| 359 | - ]); |
|
| 360 | - $table->addColumn('size', 'bigint', [ |
|
| 361 | - 'notnull' => true, |
|
| 362 | - 'length' => 11, |
|
| 363 | - 'unsigned' => true, |
|
| 364 | - ]); |
|
| 365 | - $table->setPrimaryKey(['id']); |
|
| 366 | - $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
| 367 | - $table->addIndex(['lastmodified'], 'schedulobj_lastmodified_idx'); |
|
| 368 | - } |
|
| 333 | + if (!$schema->hasTable('schedulingobjects')) { |
|
| 334 | + $table = $schema->createTable('schedulingobjects'); |
|
| 335 | + $table->addColumn('id', 'bigint', [ |
|
| 336 | + 'autoincrement' => true, |
|
| 337 | + 'notnull' => true, |
|
| 338 | + 'length' => 11, |
|
| 339 | + 'unsigned' => true, |
|
| 340 | + ]); |
|
| 341 | + $table->addColumn('principaluri', 'string', [ |
|
| 342 | + 'notnull' => false, |
|
| 343 | + 'length' => 255, |
|
| 344 | + ]); |
|
| 345 | + $table->addColumn('calendardata', 'blob', [ |
|
| 346 | + 'notnull' => false, |
|
| 347 | + ]); |
|
| 348 | + $table->addColumn('uri', 'string', [ |
|
| 349 | + 'notnull' => false, |
|
| 350 | + 'length' => 255, |
|
| 351 | + ]); |
|
| 352 | + $table->addColumn('lastmodified', 'integer', [ |
|
| 353 | + 'notnull' => false, |
|
| 354 | + 'unsigned' => true, |
|
| 355 | + ]); |
|
| 356 | + $table->addColumn('etag', 'string', [ |
|
| 357 | + 'notnull' => false, |
|
| 358 | + 'length' => 32, |
|
| 359 | + ]); |
|
| 360 | + $table->addColumn('size', 'bigint', [ |
|
| 361 | + 'notnull' => true, |
|
| 362 | + 'length' => 11, |
|
| 363 | + 'unsigned' => true, |
|
| 364 | + ]); |
|
| 365 | + $table->setPrimaryKey(['id']); |
|
| 366 | + $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); |
|
| 367 | + $table->addIndex(['lastmodified'], 'schedulobj_lastmodified_idx'); |
|
| 368 | + } |
|
| 369 | 369 | |
| 370 | - if (!$schema->hasTable('cards_properties')) { |
|
| 371 | - $table = $schema->createTable('cards_properties'); |
|
| 372 | - $table->addColumn('id', 'bigint', [ |
|
| 373 | - 'autoincrement' => true, |
|
| 374 | - 'notnull' => true, |
|
| 375 | - 'length' => 11, |
|
| 376 | - 'unsigned' => true, |
|
| 377 | - ]); |
|
| 378 | - $table->addColumn('addressbookid', 'bigint', [ |
|
| 379 | - 'notnull' => true, |
|
| 380 | - 'length' => 11, |
|
| 381 | - 'default' => 0, |
|
| 382 | - ]); |
|
| 383 | - $table->addColumn('cardid', 'bigint', [ |
|
| 384 | - 'notnull' => true, |
|
| 385 | - 'length' => 11, |
|
| 386 | - 'default' => 0, |
|
| 387 | - 'unsigned' => true, |
|
| 388 | - ]); |
|
| 389 | - $table->addColumn('name', 'string', [ |
|
| 390 | - 'notnull' => false, |
|
| 391 | - 'length' => 64, |
|
| 392 | - ]); |
|
| 393 | - $table->addColumn('value', 'string', [ |
|
| 394 | - 'notnull' => false, |
|
| 395 | - 'length' => 255, |
|
| 396 | - ]); |
|
| 397 | - $table->addColumn('preferred', 'integer', [ |
|
| 398 | - 'notnull' => true, |
|
| 399 | - 'length' => 4, |
|
| 400 | - 'default' => 1, |
|
| 401 | - ]); |
|
| 402 | - $table->setPrimaryKey(['id']); |
|
| 403 | - $table->addIndex(['cardid'], 'card_contactid_index'); |
|
| 404 | - $table->addIndex(['name'], 'card_name_index'); |
|
| 405 | - $table->addIndex(['value'], 'card_value_index'); |
|
| 406 | - } |
|
| 370 | + if (!$schema->hasTable('cards_properties')) { |
|
| 371 | + $table = $schema->createTable('cards_properties'); |
|
| 372 | + $table->addColumn('id', 'bigint', [ |
|
| 373 | + 'autoincrement' => true, |
|
| 374 | + 'notnull' => true, |
|
| 375 | + 'length' => 11, |
|
| 376 | + 'unsigned' => true, |
|
| 377 | + ]); |
|
| 378 | + $table->addColumn('addressbookid', 'bigint', [ |
|
| 379 | + 'notnull' => true, |
|
| 380 | + 'length' => 11, |
|
| 381 | + 'default' => 0, |
|
| 382 | + ]); |
|
| 383 | + $table->addColumn('cardid', 'bigint', [ |
|
| 384 | + 'notnull' => true, |
|
| 385 | + 'length' => 11, |
|
| 386 | + 'default' => 0, |
|
| 387 | + 'unsigned' => true, |
|
| 388 | + ]); |
|
| 389 | + $table->addColumn('name', 'string', [ |
|
| 390 | + 'notnull' => false, |
|
| 391 | + 'length' => 64, |
|
| 392 | + ]); |
|
| 393 | + $table->addColumn('value', 'string', [ |
|
| 394 | + 'notnull' => false, |
|
| 395 | + 'length' => 255, |
|
| 396 | + ]); |
|
| 397 | + $table->addColumn('preferred', 'integer', [ |
|
| 398 | + 'notnull' => true, |
|
| 399 | + 'length' => 4, |
|
| 400 | + 'default' => 1, |
|
| 401 | + ]); |
|
| 402 | + $table->setPrimaryKey(['id']); |
|
| 403 | + $table->addIndex(['cardid'], 'card_contactid_index'); |
|
| 404 | + $table->addIndex(['name'], 'card_name_index'); |
|
| 405 | + $table->addIndex(['value'], 'card_value_index'); |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - if (!$schema->hasTable('calendarobjects_props')) { |
|
| 409 | - $table = $schema->createTable('calendarobjects_props'); |
|
| 410 | - $table->addColumn('id', 'bigint', [ |
|
| 411 | - 'autoincrement' => true, |
|
| 412 | - 'notnull' => true, |
|
| 413 | - 'length' => 11, |
|
| 414 | - 'unsigned' => true, |
|
| 415 | - ]); |
|
| 416 | - $table->addColumn('calendarid', 'bigint', [ |
|
| 417 | - 'notnull' => true, |
|
| 418 | - 'length' => 11, |
|
| 419 | - 'default' => 0, |
|
| 420 | - ]); |
|
| 421 | - $table->addColumn('objectid', 'bigint', [ |
|
| 422 | - 'notnull' => true, |
|
| 423 | - 'length' => 11, |
|
| 424 | - 'default' => 0, |
|
| 425 | - 'unsigned' => true, |
|
| 426 | - ]); |
|
| 427 | - $table->addColumn('name', 'string', [ |
|
| 428 | - 'notnull' => false, |
|
| 429 | - 'length' => 64, |
|
| 430 | - ]); |
|
| 431 | - $table->addColumn('parameter', 'string', [ |
|
| 432 | - 'notnull' => false, |
|
| 433 | - 'length' => 64, |
|
| 434 | - ]); |
|
| 435 | - $table->addColumn('value', 'string', [ |
|
| 436 | - 'notnull' => false, |
|
| 437 | - 'length' => 255, |
|
| 438 | - ]); |
|
| 439 | - $table->setPrimaryKey(['id']); |
|
| 440 | - $table->addIndex(['objectid'], 'calendarobject_index'); |
|
| 441 | - $table->addIndex(['name'], 'calendarobject_name_index'); |
|
| 442 | - $table->addIndex(['value'], 'calendarobject_value_index'); |
|
| 443 | - } |
|
| 408 | + if (!$schema->hasTable('calendarobjects_props')) { |
|
| 409 | + $table = $schema->createTable('calendarobjects_props'); |
|
| 410 | + $table->addColumn('id', 'bigint', [ |
|
| 411 | + 'autoincrement' => true, |
|
| 412 | + 'notnull' => true, |
|
| 413 | + 'length' => 11, |
|
| 414 | + 'unsigned' => true, |
|
| 415 | + ]); |
|
| 416 | + $table->addColumn('calendarid', 'bigint', [ |
|
| 417 | + 'notnull' => true, |
|
| 418 | + 'length' => 11, |
|
| 419 | + 'default' => 0, |
|
| 420 | + ]); |
|
| 421 | + $table->addColumn('objectid', 'bigint', [ |
|
| 422 | + 'notnull' => true, |
|
| 423 | + 'length' => 11, |
|
| 424 | + 'default' => 0, |
|
| 425 | + 'unsigned' => true, |
|
| 426 | + ]); |
|
| 427 | + $table->addColumn('name', 'string', [ |
|
| 428 | + 'notnull' => false, |
|
| 429 | + 'length' => 64, |
|
| 430 | + ]); |
|
| 431 | + $table->addColumn('parameter', 'string', [ |
|
| 432 | + 'notnull' => false, |
|
| 433 | + 'length' => 64, |
|
| 434 | + ]); |
|
| 435 | + $table->addColumn('value', 'string', [ |
|
| 436 | + 'notnull' => false, |
|
| 437 | + 'length' => 255, |
|
| 438 | + ]); |
|
| 439 | + $table->setPrimaryKey(['id']); |
|
| 440 | + $table->addIndex(['objectid'], 'calendarobject_index'); |
|
| 441 | + $table->addIndex(['name'], 'calendarobject_name_index'); |
|
| 442 | + $table->addIndex(['value'], 'calendarobject_value_index'); |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - if (!$schema->hasTable('dav_shares')) { |
|
| 446 | - $table = $schema->createTable('dav_shares'); |
|
| 447 | - $table->addColumn('id', 'bigint', [ |
|
| 448 | - 'autoincrement' => true, |
|
| 449 | - 'notnull' => true, |
|
| 450 | - 'length' => 11, |
|
| 451 | - 'unsigned' => true, |
|
| 452 | - ]); |
|
| 453 | - $table->addColumn('principaluri', 'string', [ |
|
| 454 | - 'notnull' => false, |
|
| 455 | - 'length' => 255, |
|
| 456 | - ]); |
|
| 457 | - $table->addColumn('type', 'string', [ |
|
| 458 | - 'notnull' => false, |
|
| 459 | - 'length' => 255, |
|
| 460 | - ]); |
|
| 461 | - $table->addColumn('access', 'smallint', [ |
|
| 462 | - 'notnull' => false, |
|
| 463 | - 'length' => 1, |
|
| 464 | - ]); |
|
| 465 | - $table->addColumn('resourceid', 'integer', [ |
|
| 466 | - 'notnull' => true, |
|
| 467 | - 'unsigned' => true, |
|
| 468 | - ]); |
|
| 469 | - $table->addColumn('publicuri', 'string', [ |
|
| 470 | - 'notnull' => false, |
|
| 471 | - 'length' => 255, |
|
| 472 | - ]); |
|
| 473 | - $table->setPrimaryKey(['id']); |
|
| 474 | - $table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index'); |
|
| 475 | - // modified on 2024-6-21 to add performance improving indices on new instances |
|
| 476 | - $table->addIndex(['resourceid', 'type'], 'dav_shares_resourceid_type'); |
|
| 477 | - $table->addIndex(['resourceid', 'access'], 'dav_shares_resourceid_access'); |
|
| 478 | - } |
|
| 479 | - return $schema; |
|
| 480 | - } |
|
| 445 | + if (!$schema->hasTable('dav_shares')) { |
|
| 446 | + $table = $schema->createTable('dav_shares'); |
|
| 447 | + $table->addColumn('id', 'bigint', [ |
|
| 448 | + 'autoincrement' => true, |
|
| 449 | + 'notnull' => true, |
|
| 450 | + 'length' => 11, |
|
| 451 | + 'unsigned' => true, |
|
| 452 | + ]); |
|
| 453 | + $table->addColumn('principaluri', 'string', [ |
|
| 454 | + 'notnull' => false, |
|
| 455 | + 'length' => 255, |
|
| 456 | + ]); |
|
| 457 | + $table->addColumn('type', 'string', [ |
|
| 458 | + 'notnull' => false, |
|
| 459 | + 'length' => 255, |
|
| 460 | + ]); |
|
| 461 | + $table->addColumn('access', 'smallint', [ |
|
| 462 | + 'notnull' => false, |
|
| 463 | + 'length' => 1, |
|
| 464 | + ]); |
|
| 465 | + $table->addColumn('resourceid', 'integer', [ |
|
| 466 | + 'notnull' => true, |
|
| 467 | + 'unsigned' => true, |
|
| 468 | + ]); |
|
| 469 | + $table->addColumn('publicuri', 'string', [ |
|
| 470 | + 'notnull' => false, |
|
| 471 | + 'length' => 255, |
|
| 472 | + ]); |
|
| 473 | + $table->setPrimaryKey(['id']); |
|
| 474 | + $table->addUniqueIndex(['principaluri', 'resourceid', 'type', 'publicuri'], 'dav_shares_index'); |
|
| 475 | + // modified on 2024-6-21 to add performance improving indices on new instances |
|
| 476 | + $table->addIndex(['resourceid', 'type'], 'dav_shares_resourceid_type'); |
|
| 477 | + $table->addIndex(['resourceid', 'access'], 'dav_shares_resourceid_access'); |
|
| 478 | + } |
|
| 479 | + return $schema; |
|
| 480 | + } |
|
| 481 | 481 | } |
@@ -15,122 +15,122 @@ |
||
| 15 | 15 | use OCP\Migration\SimpleMigrationStep; |
| 16 | 16 | |
| 17 | 17 | class Version1011Date20200630192246 extends SimpleMigrationStep { |
| 18 | - /** |
|
| 19 | - * @param IOutput $output |
|
| 20 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 21 | - * @param array $options |
|
| 22 | - * @return null|ISchemaWrapper |
|
| 23 | - */ |
|
| 24 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 25 | - /** @var ISchemaWrapper $schema */ |
|
| 26 | - $schema = $schemaClosure(); |
|
| 18 | + /** |
|
| 19 | + * @param IOutput $output |
|
| 20 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 21 | + * @param array $options |
|
| 22 | + * @return null|ISchemaWrapper |
|
| 23 | + */ |
|
| 24 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { |
|
| 25 | + /** @var ISchemaWrapper $schema */ |
|
| 26 | + $schema = $schemaClosure(); |
|
| 27 | 27 | |
| 28 | - if (!$schema->hasTable('external_mounts')) { |
|
| 29 | - $table = $schema->createTable('external_mounts'); |
|
| 30 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 31 | - 'autoincrement' => true, |
|
| 32 | - 'notnull' => true, |
|
| 33 | - 'length' => 6, |
|
| 34 | - ]); |
|
| 35 | - $table->addColumn('mount_point', Types::STRING, [ |
|
| 36 | - 'notnull' => true, |
|
| 37 | - 'length' => 128, |
|
| 38 | - ]); |
|
| 39 | - $table->addColumn('storage_backend', Types::STRING, [ |
|
| 40 | - 'notnull' => true, |
|
| 41 | - 'length' => 64, |
|
| 42 | - ]); |
|
| 43 | - $table->addColumn('auth_backend', Types::STRING, [ |
|
| 44 | - 'notnull' => true, |
|
| 45 | - 'length' => 64, |
|
| 46 | - ]); |
|
| 47 | - $table->addColumn('priority', Types::INTEGER, [ |
|
| 48 | - 'notnull' => true, |
|
| 49 | - 'length' => 4, |
|
| 50 | - 'default' => 100, |
|
| 51 | - ]); |
|
| 52 | - $table->addColumn('type', Types::INTEGER, [ |
|
| 53 | - 'notnull' => true, |
|
| 54 | - 'length' => 4, |
|
| 55 | - ]); |
|
| 56 | - $table->setPrimaryKey(['mount_id']); |
|
| 57 | - } |
|
| 28 | + if (!$schema->hasTable('external_mounts')) { |
|
| 29 | + $table = $schema->createTable('external_mounts'); |
|
| 30 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 31 | + 'autoincrement' => true, |
|
| 32 | + 'notnull' => true, |
|
| 33 | + 'length' => 6, |
|
| 34 | + ]); |
|
| 35 | + $table->addColumn('mount_point', Types::STRING, [ |
|
| 36 | + 'notnull' => true, |
|
| 37 | + 'length' => 128, |
|
| 38 | + ]); |
|
| 39 | + $table->addColumn('storage_backend', Types::STRING, [ |
|
| 40 | + 'notnull' => true, |
|
| 41 | + 'length' => 64, |
|
| 42 | + ]); |
|
| 43 | + $table->addColumn('auth_backend', Types::STRING, [ |
|
| 44 | + 'notnull' => true, |
|
| 45 | + 'length' => 64, |
|
| 46 | + ]); |
|
| 47 | + $table->addColumn('priority', Types::INTEGER, [ |
|
| 48 | + 'notnull' => true, |
|
| 49 | + 'length' => 4, |
|
| 50 | + 'default' => 100, |
|
| 51 | + ]); |
|
| 52 | + $table->addColumn('type', Types::INTEGER, [ |
|
| 53 | + 'notnull' => true, |
|
| 54 | + 'length' => 4, |
|
| 55 | + ]); |
|
| 56 | + $table->setPrimaryKey(['mount_id']); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - if (!$schema->hasTable('external_applicable')) { |
|
| 60 | - $table = $schema->createTable('external_applicable'); |
|
| 61 | - $table->addColumn('applicable_id', Types::BIGINT, [ |
|
| 62 | - 'autoincrement' => true, |
|
| 63 | - 'notnull' => true, |
|
| 64 | - 'length' => 6, |
|
| 65 | - ]); |
|
| 66 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 67 | - 'notnull' => true, |
|
| 68 | - 'length' => 6, |
|
| 69 | - ]); |
|
| 70 | - $table->addColumn('type', Types::INTEGER, [ |
|
| 71 | - 'notnull' => true, |
|
| 72 | - 'length' => 4, |
|
| 73 | - ]); |
|
| 74 | - $table->addColumn('value', Types::STRING, [ |
|
| 75 | - 'notnull' => false, |
|
| 76 | - 'length' => 64, |
|
| 77 | - ]); |
|
| 78 | - $table->setPrimaryKey(['applicable_id']); |
|
| 79 | - $table->addIndex(['mount_id'], 'applicable_mount'); |
|
| 80 | - $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
| 81 | - } |
|
| 59 | + if (!$schema->hasTable('external_applicable')) { |
|
| 60 | + $table = $schema->createTable('external_applicable'); |
|
| 61 | + $table->addColumn('applicable_id', Types::BIGINT, [ |
|
| 62 | + 'autoincrement' => true, |
|
| 63 | + 'notnull' => true, |
|
| 64 | + 'length' => 6, |
|
| 65 | + ]); |
|
| 66 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 67 | + 'notnull' => true, |
|
| 68 | + 'length' => 6, |
|
| 69 | + ]); |
|
| 70 | + $table->addColumn('type', Types::INTEGER, [ |
|
| 71 | + 'notnull' => true, |
|
| 72 | + 'length' => 4, |
|
| 73 | + ]); |
|
| 74 | + $table->addColumn('value', Types::STRING, [ |
|
| 75 | + 'notnull' => false, |
|
| 76 | + 'length' => 64, |
|
| 77 | + ]); |
|
| 78 | + $table->setPrimaryKey(['applicable_id']); |
|
| 79 | + $table->addIndex(['mount_id'], 'applicable_mount'); |
|
| 80 | + $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - if (!$schema->hasTable('external_config')) { |
|
| 84 | - $table = $schema->createTable('external_config'); |
|
| 85 | - $table->addColumn('config_id', Types::BIGINT, [ |
|
| 86 | - 'autoincrement' => true, |
|
| 87 | - 'notnull' => true, |
|
| 88 | - 'length' => 6, |
|
| 89 | - ]); |
|
| 90 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 91 | - 'notnull' => true, |
|
| 92 | - 'length' => 6, |
|
| 93 | - ]); |
|
| 94 | - $table->addColumn('key', Types::STRING, [ |
|
| 95 | - 'notnull' => true, |
|
| 96 | - 'length' => 64, |
|
| 97 | - ]); |
|
| 98 | - $table->addColumn('value', Types::STRING, [ |
|
| 99 | - 'notnull' => false, |
|
| 100 | - 'length' => 4000, |
|
| 101 | - ]); |
|
| 102 | - $table->setPrimaryKey(['config_id']); |
|
| 103 | - $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
| 104 | - } else { |
|
| 105 | - $table = $schema->getTable('external_config'); |
|
| 106 | - $table->modifyColumn('value', [ |
|
| 107 | - 'notnull' => false, |
|
| 108 | - 'length' => 4000, |
|
| 109 | - ]); |
|
| 110 | - } |
|
| 83 | + if (!$schema->hasTable('external_config')) { |
|
| 84 | + $table = $schema->createTable('external_config'); |
|
| 85 | + $table->addColumn('config_id', Types::BIGINT, [ |
|
| 86 | + 'autoincrement' => true, |
|
| 87 | + 'notnull' => true, |
|
| 88 | + 'length' => 6, |
|
| 89 | + ]); |
|
| 90 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 91 | + 'notnull' => true, |
|
| 92 | + 'length' => 6, |
|
| 93 | + ]); |
|
| 94 | + $table->addColumn('key', Types::STRING, [ |
|
| 95 | + 'notnull' => true, |
|
| 96 | + 'length' => 64, |
|
| 97 | + ]); |
|
| 98 | + $table->addColumn('value', Types::STRING, [ |
|
| 99 | + 'notnull' => false, |
|
| 100 | + 'length' => 4000, |
|
| 101 | + ]); |
|
| 102 | + $table->setPrimaryKey(['config_id']); |
|
| 103 | + $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); |
|
| 104 | + } else { |
|
| 105 | + $table = $schema->getTable('external_config'); |
|
| 106 | + $table->modifyColumn('value', [ |
|
| 107 | + 'notnull' => false, |
|
| 108 | + 'length' => 4000, |
|
| 109 | + ]); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - if (!$schema->hasTable('external_options')) { |
|
| 113 | - $table = $schema->createTable('external_options'); |
|
| 114 | - $table->addColumn('option_id', Types::BIGINT, [ |
|
| 115 | - 'autoincrement' => true, |
|
| 116 | - 'notnull' => true, |
|
| 117 | - 'length' => 6, |
|
| 118 | - ]); |
|
| 119 | - $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 120 | - 'notnull' => true, |
|
| 121 | - 'length' => 6, |
|
| 122 | - ]); |
|
| 123 | - $table->addColumn('key', Types::STRING, [ |
|
| 124 | - 'notnull' => true, |
|
| 125 | - 'length' => 64, |
|
| 126 | - ]); |
|
| 127 | - $table->addColumn('value', Types::STRING, [ |
|
| 128 | - 'notnull' => true, |
|
| 129 | - 'length' => 256, |
|
| 130 | - ]); |
|
| 131 | - $table->setPrimaryKey(['option_id']); |
|
| 132 | - $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
| 133 | - } |
|
| 134 | - return $schema; |
|
| 135 | - } |
|
| 112 | + if (!$schema->hasTable('external_options')) { |
|
| 113 | + $table = $schema->createTable('external_options'); |
|
| 114 | + $table->addColumn('option_id', Types::BIGINT, [ |
|
| 115 | + 'autoincrement' => true, |
|
| 116 | + 'notnull' => true, |
|
| 117 | + 'length' => 6, |
|
| 118 | + ]); |
|
| 119 | + $table->addColumn('mount_id', Types::BIGINT, [ |
|
| 120 | + 'notnull' => true, |
|
| 121 | + 'length' => 6, |
|
| 122 | + ]); |
|
| 123 | + $table->addColumn('key', Types::STRING, [ |
|
| 124 | + 'notnull' => true, |
|
| 125 | + 'length' => 64, |
|
| 126 | + ]); |
|
| 127 | + $table->addColumn('value', Types::STRING, [ |
|
| 128 | + 'notnull' => true, |
|
| 129 | + 'length' => 256, |
|
| 130 | + ]); |
|
| 131 | + $table->setPrimaryKey(['option_id']); |
|
| 132 | + $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); |
|
| 133 | + } |
|
| 134 | + return $schema; |
|
| 135 | + } |
|
| 136 | 136 | } |