({ workspaceId, tableId }: RowMutationContext)
| 533 | * Add a column to an existing table. |
| 534 | */ |
| 535 | export function useAddTableColumn({ workspaceId, tableId }: RowMutationContext) { |
| 536 | const queryClient = useQueryClient() |
| 537 | |
| 538 | return useMutation({ |
| 539 | mutationFn: async (column: CreateTableColumnBodyInput['column']) => { |
| 540 | return requestJson(addTableColumnContract, { |
| 541 | params: { tableId }, |
| 542 | body: { workspaceId, column }, |
| 543 | }) |
| 544 | }, |
| 545 | onError: (error) => { |
| 546 | if (isValidationError(error)) return |
| 547 | toast.error(error.message, { duration: 5000 }) |
| 548 | }, |
| 549 | onSettled: () => { |
| 550 | invalidateTableSchema(queryClient, tableId) |
| 551 | }, |
| 552 | }) |
| 553 | } |
| 554 | |
| 555 | /** |
| 556 | * Rename a table. |
no test coverage detected