nodeAlterTableSetNotNull converts a tree.AlterTablePartition instance into an equivalent vitess.DDL instance.
(ctx *Context, node *tree.AlterTablePartition)
| 401 | |
| 402 | // nodeAlterTableSetNotNull converts a tree.AlterTablePartition instance into an equivalent vitess.DDL instance. |
| 403 | func nodeAlterTablePartition(ctx *Context, node *tree.AlterTablePartition) (*vitess.AlterTable, error) { |
| 404 | if node == nil { |
| 405 | return nil, nil |
| 406 | } |
| 407 | |
| 408 | // TODO: This is an incomplete translation because our GMS implementation doesn't support the MySQL |
| 409 | // equivalent of these statements either. Regardless, these are all no-ops. |
| 410 | treeTableName := node.Name.ToTableName() |
| 411 | tableName, err := nodeTableName(ctx, &treeTableName) |
| 412 | if err != nil { |
| 413 | return nil, err |
| 414 | } |
| 415 | |
| 416 | switch node.Spec.Type { |
| 417 | case tree.PartitionBoundIn: |
| 418 | case tree.PartitionBoundFromTo: |
| 419 | case tree.PartitionBoundWith: |
| 420 | default: |
| 421 | return nil, errors.Errorf("ALTER TABLE with unsupported partition type %v", node.Spec.Type) |
| 422 | } |
| 423 | |
| 424 | partitionDef := &vitess.PartitionDefinition{ |
| 425 | Name: vitess.NewColIdent(node.Partition.String()), |
| 426 | } |
| 427 | |
| 428 | actionStr := "" |
| 429 | if node.IsDetach { |
| 430 | actionStr = vitess.DropStr |
| 431 | } else { |
| 432 | actionStr = vitess.AddStr |
| 433 | } |
| 434 | |
| 435 | partitionSpec := &vitess.PartitionSpec{ |
| 436 | Action: actionStr, |
| 437 | Definitions: []*vitess.PartitionDefinition{partitionDef}, |
| 438 | } |
| 439 | |
| 440 | return &vitess.AlterTable{ |
| 441 | Table: tableName, |
| 442 | PartitionSpecs: []*vitess.PartitionSpec{partitionSpec}, |
| 443 | }, nil |
| 444 | } |
| 445 | |
| 446 | // nodeAlterTableComputed converts a tree.AlterTableComputed instance into an equivalent CREATE/ALTER SEQUENCE statement. |
| 447 | func nodeAlterTableComputed(ctx *Context, tableName tree.TableName, node *tree.AlterTableComputed) (vitess.Statement, error) { |
no test coverage detected