$this->fields =
$this->
formatFields($this->db->
getFieldData($table));
$this->keys =
array_merge($this->keys,
$this->
formatKeys($this->db->
getIndexData($table)));
// if primary key index exists twice then remove psuedo index name 'primary'.
$primaryIndexes =
array_filter($this->keys,
static fn ($index) =>
$index['type'
] === 'primary'
);
if (!
empty($primaryIndexes) &&
count($primaryIndexes) > 1 &&
array_key_exists('primary',
$this->keys
)) { unset($this->keys
['primary'
]);
} $this->foreignKeys =
$this->db->
getForeignKeyData($table);
return $this;
} /**
* Called after `fromTable` and any actions, like `dropColumn`, etc,
* to finalize the action. It creates a temp table, creates the new
* table with modifications, and copies the data over to the new table.
* Resets the connection dataCache to be sure changes are collected.
*/
public function run(): bool
{