classAlterDropColumn
final class AlterDropColumn
implements Statement
uses Snapshot
@visibility public.A request to remove a column from a table.
Rule: SQLITE-ALTER-DROP-COLUMN-001. The resolution of the table is the relation fact of the statement node. When the column list of the table is completely known, a name that is no column of it and the removal of its only column are diagnostics. The other reasons SQLite refuses a removal (a primary key, unique, indexed or referenced column) need constraints and indexes a declaration context does not hold. The optional COLUMN keyword is not written. The statement changes no declaration and provides none. Source: https://sqlite.org/lang_altertable.html#alter_table_drop_column. Status: Implemented.
$alter = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('ALTER TABLE t DROP COLUMN b');
[$alter->statement->column->value, $alter->toString()] // => ['b', 'ALTER TABLE t DROP b']Properties§
public QualifiedName $tablepublic Name $columnMethods§
public function __construct(public QualifiedName $table, public Name $column)Parameters
$table | QualifiedName | The table to change |
$column | Name | The column to remove |
Calls 1
- static-call Check::input() line 49
public function deriveStatement(Derivation $derivation): voidRecords the resolution of the table and reports a removal the declared columns rule out.
Parameters
$derivation | Derivation |
Calls 8
- method-call Derivation::target() line 57
- method-call TableShapes::target() line 57
- new TableShapes line 57
- method-call RelationKinds::refuse() line 58
- new RelationKinds line 58
- class-const KindRefusal::DropColumn() line 58
- method-call AlterationProblems::dropped() line 59
- new AlterationProblems line 59
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 68
- method-call ObjectNames::write() line 69
- new ObjectNames line 69
- class-const NameUse::Column() line 70
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.