Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Dec 9, 2024
1 parent 44c4594 commit 7475662
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/DataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Flarum\User\User;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

/**
* Class DataProcessor.
Expand Down Expand Up @@ -112,20 +113,19 @@ public function allUserColumns(): array
$user = new User();
$connection = $user->getConnection();
$table = $user->getTable();
$prefix = $connection->getTablePrefix();

// Get column listings for the user table
$columns = $connection->getSchemaBuilder()->getColumnListing($table);
$columns = $connection->getSchemaBuilder()->getColumns($table);
$columnDetails = [];

foreach ($columns as $column) {
$doctrineColumn = $connection->getDoctrineColumn($prefix.$table, $column);

$columnDetails[$column] = [
'type' => $doctrineColumn->getType()->getName(),
'length' => $doctrineColumn->getLength(),
'default' => $doctrineColumn->getDefault(),
'nullable' => !$doctrineColumn->getNotnull(),
$columnDetails[$column['name']] = [
'type' => $column['type_name'],
'length' => str_contains($column['type'], '(')
? intval(Str::of($column['type'])->afterLast('(')->beforeLast(')')->toString())
: null,
'default' => $column['default'],
'nullable' => $column['nullable'],
];
}

Expand Down

0 comments on commit 7475662

Please sign in to comment.