diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-08-17 08:00:08 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-08-17 08:46:55 +0200 |
commit | 71918f1a0eaffab2e58379573f16b22e782cc17d (patch) | |
tree | bc7d72ecb1b4cbf8f1cb43f11b34b2efd7686c8a | |
parent | db2b8912bc184fc357eba86446dcfa475bf935b8 (diff) |
Only add index if does not exist yetbugfix/noid/ci
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | lib/Migration/Version0003Date20200611000001.php | 4 | ||||
-rw-r--r-- | lib/Migration/Version0003Date20200730213528.php | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/Migration/Version0003Date20200611000001.php b/lib/Migration/Version0003Date20200611000001.php index eed82542..51274e52 100644 --- a/lib/Migration/Version0003Date20200611000001.php +++ b/lib/Migration/Version0003Date20200611000001.php @@ -1056,7 +1056,7 @@ class Version0003Date20200611000001 extends SimpleMigrationStep { ); $table->setPrimaryKey(['id']); - $table->addIndex(['chunk'], 'chunk'); + $table->addIndex(['chunk'], 'chunk_act'); $table->addUniqueIndex(['stream_id_prim', 'actor_id_prim'], 'sa'); } @@ -1111,7 +1111,7 @@ class Version0003Date20200611000001 extends SimpleMigrationStep { ] ); - $table->addIndex(['chunk'], 'chunk'); + $table->addIndex(['chunk'], 'chunk_dest'); $table->addUniqueIndex(['stream_id', 'actor_id', 'type'], 'sat'); $table->addIndex(['type', 'subtype'], 'ts'); } diff --git a/lib/Migration/Version0003Date20200730213528.php b/lib/Migration/Version0003Date20200730213528.php index cf7fed6d..e0e3a5a8 100644 --- a/lib/Migration/Version0003Date20200730213528.php +++ b/lib/Migration/Version0003Date20200730213528.php @@ -73,9 +73,9 @@ class Version0003Date20200730213528 extends SimpleMigrationStep { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - $this->addChunkToTable($schema, 'social_3_stream'); - $this->addChunkToTable($schema, 'social_3_stream_act'); - $this->addChunkToTable($schema, 'social_3_stream_dest'); + $this->addChunkToTable($schema, 'social_3_stream', ''); + $this->addChunkToTable($schema, 'social_3_stream_act', '_act'); + $this->addChunkToTable($schema, 'social_3_stream_dest', '_dest'); return $schema; } @@ -87,7 +87,7 @@ class Version0003Date20200730213528 extends SimpleMigrationStep { * * @throws SchemaException */ - private function addChunkToTable(ISchemaWrapper $schema, string $tableName) { + private function addChunkToTable(ISchemaWrapper $schema, string $tableName, string $indexName) { if (!$schema->hasTable($tableName)) { return; } @@ -105,8 +105,9 @@ class Version0003Date20200730213528 extends SimpleMigrationStep { 'unsigned' => true ] ); - - $table->addIndex(['chunk'], 'chunk'); + if (!$table->hasIndex('chunk' . $indexName)) { + $table->addIndex(['chunk'], 'chunk' . $indexName); + } } |