Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Sources/Db/APIs/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1169,10 +1169,16 @@ public function table_sql(string $table_name): string
$inner_lines = [];

foreach ($structure['columns'] as $column) {
$line = ' `' . $column['name'] . '` ' . $column['type'];
// The structure reports SMF's own name for a type that MySQL
// spells differently -- a varbinary(16) holding an address comes
// back as an inet -- so it has to be turned back into something
// MySQL knows before it can be written into a CREATE TABLE.
list($type, $size) = $this->calculate_type($column['type'], $column['size']);

if (is_numeric($column['size'])) {
$line .= '(' . $column['size'] . ')';
$line = ' `' . $column['name'] . '` ' . $type;

if (is_numeric($size)) {
$line .= '(' . $size . ')';
}

if (!empty($column['unsigned'])) {
Expand Down