classColumnAction
final class ColumnAction
implements AlterCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.An action on a column without an operand: SET/DROP NOT NULL, DROP DEFAULT, DROP EXPRESSION, DROP IDENTITY.
Mirrors AT_SetNotNull, AT_DropNotNull, AT_ColumnDefault without a default, AT_DropExpression and AT_DropIdentity (with missing_ok for IF EXISTS). The optional COLUMN word is not kept. Source: https://www.postgresql.org/docs/17/sql-altertable.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER TABLE t ALTER COLUMN a DROP NOT NULL');
$statement->statement->commands[0]->kind // => \SqlSemantics\Platform\PostgreSql\Statement\Table\Alter\Column\ColumnActionKind::DropNotNullProperties§
public ColumnActionKind $kindpublic Name $columnMethods§
public function __construct(public ColumnActionKind $kind, public Name $column)Parameters
$kind | ColumnActionKind | The action |
$column | Name | The column |
public function deriveClause(Derivation $derivation, Environment $environment): voidChecks that the column exists, unless IF EXISTS is written.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 3
- method-call ColumnActionKind::conditional() line 44
- method-call Alterations::column() line 45
- new Alterations line 45
public function render(Output $out): voidWrites ALTER, the column and the action.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 54
- function-call
explodeline 54
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ColumnActionTestcalls
Other tests reaching this symbol 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::command() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:124
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\AlterCommandRule::defaulted() packages/sql-semantics-postgres/src/Lowering/Table/AlterCommandRule.php:227
Type checks 5
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\AlterKinds::accepted() packages/sql-semantics-postgres/src/Rules/Table/Command/AlterKinds.php:140
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Alterations::identity() packages/sql-semantics-postgres/src/Rules/Table/Command/Alterations.php:106
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::check() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:53
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::rule() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:71
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Table\Command\GeneratedChanges::dropped() packages/sql-semantics-postgres/src/Rules/Table/Command/GeneratedChanges.php:101