Skip to content

Commit cd29577

Browse files
committed
alter table now supports indexes
1 parent a088ea3 commit cd29577

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/Session.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,16 +507,19 @@ public function dropTable($table)
507507
/**
508508
* @param string $table
509509
* @param array $columns
510+
* @param array $indexes
510511
* @return bool|mixed|void|null
511512
* @throws Exception
512513
*/
513-
public function alterTable($table, $columns = [])
514+
public function alterTable($table, $columns = [], $indexes = [])
514515
{
515516
return $this->request('AlterTable', [
516517
'path' => $this->pathPrefix($table),
517518
'add_columns' => $this->convertColumns($columns['add'] ?? []),
518519
'drop_columns' => $columns['drop'] ?? [],
519520
'alter_columns' => $this->convertColumns($columns['alter'] ?? []),
521+
'add_indexes' => $this->convertIndexes($indexes['add'] ?? []),
522+
'drop_indexes' => $indexes['drop'] ?? [],
520523
'session_id' => $this->session_id,
521524
]);
522525
}

src/Table.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,13 @@ public function dropTable($table)
324324
*
325325
* @param string $table
326326
* @param array $columns
327+
* @param array $indexes
327328
* @return bool|mixed|void|null
328329
* @throws Exception
329330
*/
330-
public function alterTable($table, $columns = [])
331+
public function alterTable($table, $columns = [], $indexes = [])
331332
{
332-
return $this->session()->alterTable($table, $columns);
333+
return $this->session()->alterTable($table, $columns, $indexes);
333334
}
334335

335336
/**

src/Traits/RequestTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ protected function processResponse($service, $method, $response, $resultClass)
186186

187187
switch ($statusCode)
188188
{
189+
case StatusCode::STATUS_CODE_UNSPECIFIED:
190+
return true;
191+
break;
192+
189193
case StatusCode::SUCCESS:
190194
$result = $response->getResult();
191195

0 commit comments

Comments
 (0)