Skip to content

Commit

Permalink
Remove hard-coded string column length
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed May 14, 2022
1 parent e8ed43b commit cdf52e4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
Binary file added dbal.sqlite
Binary file not shown.
3 changes: 0 additions & 3 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,6 @@ private function getSimpleAlterTableSQL(TableDiff $diff): array|false
}

$definition['name'] = $column->getQuotedName($this);
if ($type instanceof Types\StringType && $definition['length'] === null) {
$definition['length'] = 255;
}

$sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ADD COLUMN '
. $this->getColumnDeclarationSQL($definition['name'], $definition);
Expand Down
2 changes: 1 addition & 1 deletion tests/Platforms/SqlitePlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function testAlterTableAddColumns(): void
]);

$expected = [
'ALTER TABLE user ADD COLUMN foo VARCHAR(255) NOT NULL',
'ALTER TABLE user ADD COLUMN foo VARCHAR NOT NULL',
'ALTER TABLE user ADD COLUMN count INTEGER DEFAULT 1',
];

Expand Down

0 comments on commit cdf52e4

Please sign in to comment.