Skip to content

Commit 62f12d0

Browse files
committed
pass default data for integer
1 parent 28e0a93 commit 62f12d0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Parser/CreateTableParser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ private function extractTokens(string $sql, array $source_map): array
669669
$i = 0;
670670
$len = \count($source_map);
671671
while ($i < $len) {
672-
$token = \substr($sql, $source_map[$i][0], $source_map[$i][1]) ?: '';
672+
$token = \substr($sql, $source_map[$i][0], $source_map[$i][1]);
673+
$token = $token !== false ? $token : '';
673674
$tokenUpper = \strtoupper($token);
674675
if (\array_key_exists($tokenUpper, $maps)) {
675676
$found = false;

tests/fixtures/create_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CREATE TABLE `video_game_characters` (
1313
`nullable_field_default_0` tinyint(3) DEFAULT '0',
1414
`some_float` float DEFAULT '0.00',
1515
`total_games` int(11) UNSIGNED NOT NULL DEFAULT '0',
16-
`lives` int(11) UNSIGNED NOT NULL DEFAULT '0',
16+
`lives` int(11) UNSIGNED NOT NULL DEFAULT 0,
1717
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1818
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1919
`deleted_on` timestamp NULL DEFAULT NULL,

0 commit comments

Comments
 (0)