/** * Compile a rename column command. * * @param \Nova\Database\Schema\Blueprint $blueprint * @param \Nova\Support\Fluent $command * @param \Nova\Database\Connection $connection * @return array */ public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection) { $schema = $connection->getDoctrineSchemaManager(); $table = $this->getTablePrefix() . $blueprint->getTable(); $column = $connection->getDoctrineColumn($table, $command->from); $tableDiff = $this->getRenamedDiff($blueprint, $command, $column, $schema); return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); }
/** * Compile a drop column command. * * @param \Nova\Database\Schema\Blueprint $blueprint * @param \Nova\Support\Fluent $command * @param \Nova\Database\Connection $connection * @return array */ public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection) { $schema = $connection->getDoctrineSchemaManager(); $tableDiff = $this->getDoctrineTableDiff($blueprint, $schema); foreach ($command->columns as $name) { $column = $connection->getDoctrineColumn($blueprint->getTable(), $name); $tableDiff->removedColumns[$name] = $column; } return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff); }