| @@ 13-25 (lines=13) @@ | ||
| 10 | { |
|
| 11 | use MigrationTrait; |
|
| 12 | ||
| 13 | private function createDatabase(): void |
|
| 14 | { |
|
| 15 | $client = $this->connector->getConnection(); |
|
| 16 | $databaseName = $this->getDatabaseName(); |
|
| 17 | ||
| 18 | try { |
|
| 19 | $client->put('/'.$databaseName); |
|
| 20 | } catch (RequestException $error) { |
|
| 21 | if (!$error->hasResponse() || !$error->getResponse()->getStatusCode() === 409) { |
|
| 22 | throw new MigrationException($error->getMessage()); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| 27 | private function deleteDatabase(): void |
|
| 28 | { |
|
| @@ 27-39 (lines=13) @@ | ||
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| 27 | private function deleteDatabase(): void |
|
| 28 | { |
|
| 29 | $client = $this->connector->getConnection(); |
|
| 30 | $databaseName = $this->getDatabaseName(); |
|
| 31 | ||
| 32 | try { |
|
| 33 | $client->delete('/'.$databaseName); |
|
| 34 | } catch (RequestException $error) { |
|
| 35 | if (!$error->hasResponse() || !$error->getResponse()->getStatusCode() === 404) { |
|
| 36 | throw new MigrationException($error->getMessage()); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | private function createDesignDoc(string $name, array $views): void |
|
| 42 | { |
|