From a159a3f85b1efe1ec32f227c58189bb601955dd6 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 18 Mar 2016 17:41:14 +0100 Subject: [PATCH 1/7] Structure::analyzeForeignKeys() fixed lowercased name [Closes #122] --- src/Database/Structure.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Database/Structure.php b/src/Database/Structure.php index 676d4ddf0..1c20600a0 100644 --- a/src/Database/Structure.php +++ b/src/Database/Structure.php @@ -217,13 +217,14 @@ protected function analyzePrimaryKey(array $columns) protected function analyzeForeignKeys(& $structure, $table) { + $lowerTable = strtolower($table); foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) { - $structure['belongsTo'][strtolower($table)][$row['local']] = $row['table']; + $structure['belongsTo'][$lowerTable][$row['local']] = $row['table']; $structure['hasMany'][strtolower($row['table'])][$table][] = $row['local']; } - if (isset($structure['belongsTo'][$table])) { - uksort($structure['belongsTo'][$table], function ($a, $b) { + if (isset($structure['belongsTo'][$lowerTable])) { + uksort($structure['belongsTo'][$lowerTable], function ($a, $b) { return strlen($a) - strlen($b); }); } From 21bb8cb52c42bc7b65861b1f0542c2b28576eaef Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 18 Mar 2016 18:37:47 +0100 Subject: [PATCH 2/7] typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1338b4dd5..93980184c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ before_script: # Create Postgre database - psql -c 'CREATE DATABASE nette_test' -U postgres - + sudo: false cache: From 6ce183c2a52959973220855221235f0db42d5a73 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 23 Feb 2016 14:15:35 +0100 Subject: [PATCH 3/7] ConnectionPanel: ob_start() is protected against flush when error occurs --- src/Bridges/DatabaseTracy/ConnectionPanel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bridges/DatabaseTracy/ConnectionPanel.php b/src/Bridges/DatabaseTracy/ConnectionPanel.php index 0e7e2301a..2eb2220a3 100644 --- a/src/Bridges/DatabaseTracy/ConnectionPanel.php +++ b/src/Bridges/DatabaseTracy/ConnectionPanel.php @@ -100,7 +100,7 @@ public function getTab() $name = $this->name; $count = $this->count; $totalTime = $this->totalTime; - ob_start(); + ob_start(function () {}); require __DIR__ . '/templates/ConnectionPanel.tab.phtml'; return ob_get_clean(); } @@ -131,7 +131,7 @@ public function getPanel() $queries[] = $query; } - ob_start(); + ob_start(function () {}); require __DIR__ . '/templates/ConnectionPanel.panel.phtml'; return ob_get_clean(); } From 02a2cd23c85f02c94cd9badd08305424ac2c3bf8 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 21 Apr 2016 11:36:22 +0200 Subject: [PATCH 4/7] travis: fixed PHP 5.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 93980184c..4012864ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 5.3.3 + - 5.3 - 5.4 - 5.5 - 5.6 From 68ed933c7a2650691fd82ab5af0388ba6fecb522 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 17 May 2016 12:15:30 +0200 Subject: [PATCH 5/7] tests: compatible with master nette/di --- tests/Database.DI/DatabaseExtension.basic.phpt | 2 +- tests/Database.DI/DatabaseExtension.multiple.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Database.DI/DatabaseExtension.basic.phpt b/tests/Database.DI/DatabaseExtension.basic.phpt index be4bb76c9..f9d98d0d2 100644 --- a/tests/Database.DI/DatabaseExtension.basic.phpt +++ b/tests/Database.DI/DatabaseExtension.basic.phpt @@ -29,7 +29,7 @@ test(function () { $compiler = new DI\Compiler; $compiler->addExtension('database', new DatabaseExtension(FALSE)); - eval($compiler->compile($config, 'Container1')); + eval(@$compiler->compile($config, 'Container1')); // @ compatibility with DI 2.4 $container = new Container1; $container->initialize(); diff --git a/tests/Database.DI/DatabaseExtension.multiple.phpt b/tests/Database.DI/DatabaseExtension.multiple.phpt index 28c7883b2..3a2bde0ad 100644 --- a/tests/Database.DI/DatabaseExtension.multiple.phpt +++ b/tests/Database.DI/DatabaseExtension.multiple.phpt @@ -38,7 +38,7 @@ test(function () { $compiler = new DI\Compiler; $compiler->addExtension('database', new DatabaseExtension(FALSE)); - eval($compiler->compile($config, 'Container1')); + eval(@$compiler->compile($config, 'Container1')); // @ compatibility with DI 2.4 $container = new Container1; $container->initialize(); From e89c75ac5f63516b7fb7a4d71876da3358c3a791 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 17 May 2016 17:34:18 +0200 Subject: [PATCH 6/7] travis: removed HHVM --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4012864ed..a51d9d0cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,12 +5,8 @@ php: - 5.5 - 5.6 - 7.0 - - hhvm matrix: - allow_failures: - - php: hhvm - include: - php: 5.6 env: dependencies="--prefer-lowest --prefer-stable" From a4c7ea17470a7d888df5738f5e63b2605899f289 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 30 May 2016 16:52:29 +0200 Subject: [PATCH 7/7] Helpers::detectType() detects DATERANGE as text --- src/Database/Helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Helpers.php b/src/Database/Helpers.php index c03e19a80..dc6e17c6e 100644 --- a/src/Database/Helpers.php +++ b/src/Database/Helpers.php @@ -28,7 +28,7 @@ class Helpers 'CURRENCY|REAL|MONEY|FLOAT|DOUBLE|DECIMAL|NUMERIC|NUMBER' => IStructure::FIELD_FLOAT, '^TIME$' => IStructure::FIELD_TIME, 'TIME' => IStructure::FIELD_DATETIME, // DATETIME, TIMESTAMP - 'DATE' => IStructure::FIELD_DATE, + 'DATE(?!RANGE)' => IStructure::FIELD_DATE, 'BOOL' => IStructure::FIELD_BOOL, );