Skip to content

Commit e65302a

Browse files
committed
Merge branch '4.2.x' into 4.3.x
* 4.2.x: Bump doctrine/.github from 7.2.2 to 7.3.0 (#6985) Deterministic ordering in schema manager results Nightly build tweaks Fix SQLite schema emulation in SqliteSchemaManager
2 parents 44ea885 + 5bbe026 commit e65302a

File tree

7 files changed

+91
-6
lines changed

7 files changed

+91
-6
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ on:
2525
jobs:
2626
coding-standards:
2727
name: "Coding Standards"
28-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.2.2"
28+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.3.0"
2929
with:
3030
composer-options: "--ignore-platform-req=php+"

.github/workflows/continuous-integration.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ on:
2424
schedule:
2525
- cron: "42 3 * * *"
2626

27-
env:
28-
fail-fast: true
29-
3027
jobs:
3128
phpunit-smoke-check:
3229
name: "PHPUnit with SQLite"

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
documentation:
1919
name: "Documentation"
20-
uses: "doctrine/.github/.github/workflows/documentation.yml@7.2.2"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@7.3.0"

.github/workflows/nightly.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: "ubuntu-24.04"
1212

1313
strategy:
14+
fail-fast: false
1415
matrix:
1516
php-version:
1617
- "8.3"
@@ -80,6 +81,7 @@ jobs:
8081
dependency-versions: ${{ matrix.dependency-versions }}
8182

8283
strategy:
84+
fail-fast: false
8385
matrix:
8486
os:
8587
- ubuntu-24.04
@@ -100,6 +102,7 @@ jobs:
100102
extension: ${{ matrix.extension }}
101103

102104
strategy:
105+
fail-fast: false
103106
matrix:
104107
php-version:
105108
- '8.5'
@@ -118,6 +121,7 @@ jobs:
118121
extension: ${{ matrix.extension }}
119122

120123
strategy:
124+
fail-fast: false
121125
matrix:
122126
php-version:
123127
- '8.5'
@@ -136,6 +140,7 @@ jobs:
136140
collation: ${{ matrix.collation }}
137141

138142
strategy:
143+
fail-fast: false
139144
matrix:
140145
php-version:
141146
- '8.5'
@@ -154,6 +159,7 @@ jobs:
154159
extension: ${{ matrix.extension }}
155160

156161
strategy:
162+
fail-fast: false
157163
matrix:
158164
php-version:
159165
- '8.5'
@@ -173,6 +179,7 @@ jobs:
173179
postgres-locale-provider: ${{ matrix.postgres-locale-provider }}
174180

175181
strategy:
182+
fail-fast: false
176183
matrix:
177184
php-version:
178185
- '8.5'

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ on:
2525
jobs:
2626
static-analysis-phpstan:
2727
name: "Static Analysis"
28-
uses: "doctrine/.github/.github/workflows/phpstan.yml@7.2.2"
28+
uses: "doctrine/.github/.github/workflows/phpstan.yml@7.3.0"

src/Schema/PostgreSQLSchemaManager.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ protected function selectTableNames(string $databaseName): Result
343343
AND table_name != 'geometry_columns'
344344
AND table_name != 'spatial_ref_sys'
345345
AND table_type = 'BASE TABLE'
346+
ORDER BY
347+
quote_ident(table_name)
346348
SQL;
347349

348350
return $this->connection->executeQuery($sql, [$databaseName]);
@@ -471,6 +473,7 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN
471473
ON n.oid = c.relnamespace
472474
WHERE %s)
473475
AND r.contype = 'f'
476+
ORDER BY 1, 2
474477
SQL,
475478
implode(' AND ', $this->buildQueryConditions($tableName, $params)),
476479
);

tests/Functional/Schema/SQLiteSchemaManagerTest.php

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
1313
use Doctrine\DBAL\Schema\Index;
1414
use Doctrine\DBAL\Schema\PrimaryKeyConstraint;
15+
use Doctrine\DBAL\Schema\SQLiteSchemaManager;
1516
use Doctrine\DBAL\Schema\Table;
1617
use Doctrine\DBAL\Schema\TableDiff;
1718
use Doctrine\DBAL\Types\BlobType;
@@ -20,8 +21,10 @@
2021
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
2122

2223
use function array_keys;
24+
use function array_map;
2325
use function array_shift;
2426
use function array_values;
27+
use function assert;
2528

2629
class SQLiteSchemaManagerTest extends SchemaManagerFunctionalTestCase
2730
{
@@ -495,6 +498,81 @@ public function testShorthandInForeignKeyReferenceWithMultipleColumns(): void
495498
);
496499
}
497500

501+
public function testListTableNoSchemaEmulation(): void
502+
{
503+
$databasePlatform = $this->connection->getDatabasePlatform();
504+
assert($databasePlatform instanceof SQLitePlatform);
505+
506+
$this->dropTableIfExists('`list_table_no_schema_emulation.test`');
507+
508+
$this->connection->executeStatement(<<<'DDL'
509+
CREATE TABLE `list_table_no_schema_emulation.test` (
510+
id INTEGER,
511+
parent_id INTEGER,
512+
PRIMARY KEY (id),
513+
FOREIGN KEY (parent_id) REFERENCES `list_table_no_schema_emulation.test` (id)
514+
);
515+
DDL);
516+
517+
$this->connection->executeStatement(<<<'DDL'
518+
CREATE INDEX i ON `list_table_no_schema_emulation.test` (parent_id);
519+
DDL);
520+
521+
$customSQLiteSchemaManager = new class ($this->connection, $databasePlatform) extends SQLiteSchemaManager {
522+
/** @return list<array<string, mixed>> */
523+
public function selectTableColumnsWithSchema(): array
524+
{
525+
return $this->selectTableColumns('main', 'list_table_no_schema_emulation.test')
526+
->fetchAllAssociative();
527+
}
528+
529+
/** @return list<array<string, mixed>> */
530+
public function selectIndexColumnsWithSchema(): array
531+
{
532+
return $this->selectIndexColumns('main', 'list_table_no_schema_emulation.test')
533+
->fetchAllAssociative();
534+
}
535+
536+
/** @return list<array<string, mixed>> */
537+
public function selectForeignKeyColumnsWithSchema(): array
538+
{
539+
return $this->selectForeignKeyColumns('main', 'list_table_no_schema_emulation.test')
540+
->fetchAllAssociative();
541+
}
542+
};
543+
544+
self::assertSame(
545+
[
546+
['list_table_no_schema_emulation.test', 'id'],
547+
['list_table_no_schema_emulation.test', 'parent_id'],
548+
],
549+
array_map(
550+
static fn (array $row) => [$row['table_name'], $row['name']],
551+
$customSQLiteSchemaManager->selectTableColumnsWithSchema(),
552+
),
553+
);
554+
555+
self::assertSame(
556+
[
557+
['list_table_no_schema_emulation.test', 'i'],
558+
],
559+
array_map(
560+
static fn (array $row) => [$row['table_name'], $row['name']],
561+
$customSQLiteSchemaManager->selectIndexColumnsWithSchema(),
562+
),
563+
);
564+
565+
self::assertSame(
566+
[
567+
['list_table_no_schema_emulation.test', 'parent_id', 'id'],
568+
],
569+
array_map(
570+
static fn (array $row) => [$row['table_name'], $row['from'], $row['to']],
571+
$customSQLiteSchemaManager->selectForeignKeyColumnsWithSchema(),
572+
),
573+
);
574+
}
575+
498576
/**
499577
* This test duplicates {@see parent::testCommentInTable()} with the only difference that the name of the table
500578
* being created is quoted. It is only meant to cover the logic of parsing the SQLite CREATE TABLE statement

0 commit comments

Comments
 (0)