Emergency Feature request : MySqlGrammar & MySqlProcessor to return a column Length 🙏😭🙏 #52523
Unanswered
Ronan-Lenor
asked this question in
Ideas
Replies: 2 comments 3 replies
-
If it will be implemented it will be with luck in L11, maybe only in L12. Until then you can do it on your own using macros or custom implementation. |
Beta Was this translation helpful? Give feedback.
0 replies
-
$columns = collect(Schema::getColumns('my_table'))->map(function ($column) {
$column['length'] = in_array($column['type_name'], ['char', 'varchar', 'binary', 'varbinary'])
? (int) Str::between($column['type'], '(', ')')
: null;
return $column;
})->all(); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
i need to get the length of a column and saw that the arrays returned by
Schema::getConnection()->getSchemaBuilder()->getColumns('my_table')
don't have it.That would be super easy and fast to add that property in the result by modifying :
.\src\Illuminate\Database\Schema\Grammars\MySqlGrammar.php
>compileColumns()
.\src\Illuminate\Database\Query\Processors\MySqlProcessor.php
>processColumns()
is it possible ? 🙄
Beta Was this translation helpful? Give feedback.
All reactions