File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1430,6 +1430,27 @@ public function dropTable($tableId, $options = ['async' => true])
14301430 return $ result ;
14311431 }
14321432
1433+ /**
1434+ * Swap two tables. Aliases are not transferred — they keep pointing at
1435+ * the same physical position, so after the swap they expose the data of
1436+ * the other table.
1437+ *
1438+ * @return array<string, mixed>
1439+ */
1440+ public function swapTables (string $ tableId , string $ targetTableId ): array
1441+ {
1442+ if (!$ this instanceof BranchAwareClient) {
1443+ throw new ClientException ('Swapping tables is supported only in dev branch. Use BranchAwareClient instance. ' );
1444+ }
1445+
1446+ /** @var array<string, mixed> $result */
1447+ $ result = $ this ->apiPostJson ("tables/ {$ tableId }/swap " , [
1448+ 'targetTableId ' => $ targetTableId ,
1449+ ]);
1450+ $ this ->log ("Table {$ tableId } swapped with {$ targetTableId }" );
1451+ return $ result ;
1452+ }
1453+
14331454 /**
14341455 *
14351456 * Add column to table
You can’t perform that action at this time.
0 commit comments