Skip to content

Commit

Permalink
fix: only use casting at alter table
Browse files Browse the repository at this point in the history
This method is used to get the type of column, when is creating the
table, will return wrong value. If is creating all tables, Doctrine
don't will run step by step, will get all changes and apply in only a
time

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 11, 2024
1 parent c3a764f commit 1ba832f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Migration/Version8000Date20240405142042.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
class PostgreSQLJsonType extends JsonType {
public function getSQLDeclaration(array $column, AbstractPlatform $platform) {
$return = parent::getSQLDeclaration($column, $platform);
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
$isCreateTable = array_filter($backtrace, fn ($step) => in_array($step['function'], ['_getCreateTableSQL', 'getCreateTablesSQL']));
if ($isCreateTable) {
return $return;
}
return implode(' ', [
$return,
$column['comment'],
Expand Down

0 comments on commit 1ba832f

Please sign in to comment.