Skip to content

Commit f9b2461

Browse files
Merge pull request #47 from TheDragonCode/andrey-helldar-patch-1
Added Laravel 12 support
2 parents d90b8d3 + 5c29143 commit f9b2461

39 files changed

+126
-28
lines changed

.github/workflows/phpunit.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: phpunit
22

3-
on: [ push, pull_request ]
3+
on: [ push ]
44

55
jobs:
66
build:
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: true
1111
matrix:
1212
php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ]
13-
laravel: [ "8.0", "9.0", "10.0", "11.0" ]
13+
laravel: [ "8.0", "9.0", "10.0", "11.0", "12.0" ]
1414
psql: [ "9", "10", "11", "12", "13", "14", "15", "16", "17" ]
1515
exclude:
1616
- laravel: "8.0"
@@ -42,6 +42,21 @@ jobs:
4242

4343
- laravel: "11.0"
4444
psql: "11"
45+
46+
- laravel: "12.0"
47+
php: "8.0"
48+
49+
- laravel: "12.0"
50+
php: "8.1"
51+
52+
- laravel: "12.0"
53+
psql: "9"
54+
55+
- laravel: "12.0"
56+
psql: "10"
57+
58+
- laravel: "12.0"
59+
psql: "11"
4560

4661
name: php ${{ matrix.php }}, lr ${{ matrix.laravel }}, pg ${{ matrix.psql }}
4762

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
3131
| Service | Versions |
3232
|:----------|:-----------------------------------|
3333
| PHP | ^8.0 |
34-
| Laravel | ^8.0, ^9.0, ^10.0, ^11.0 |
34+
| Laravel | ^8.0, ^9.0, ^10.0, ^11.0, ^12.0 |
3535
| Databases | MySQL 5.7+, PostgreSQL 9.5+, MSSQL |
3636

3737
| Laravel \ PostgreSQL | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
@@ -40,6 +40,7 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
4040
| 9 ||||||||||
4141
| 10 ||||||||||
4242
| 11 | ✖️ | ✖️ | ✖️ |||||||
43+
| 12 | ✖️ | ✖️ | ✖️ |||||||
4344

4445

4546
## Usage

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@
3737
"require": {
3838
"php": "^8.0",
3939
"ext-pdo": "*",
40-
"doctrine/dbal": "^3.0 || ^4.0",
4140
"dragon-code/contracts": "^2.15",
4241
"dragon-code/support": "^6.0",
43-
"illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0",
44-
"illuminate/database": "^8.0 || ^9.0 || ^10.0 || ^11.0",
45-
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0"
42+
"illuminate/contracts": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
43+
"illuminate/database": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
44+
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
4645
},
4746
"require-dev": {
4847
"ext-pdo_mysql": "*",
4948
"ext-pdo_pgsql": "*",
49+
"doctrine/dbal": "^3.0 || ^4.0",
5050
"mockery/mockery": "^1.0",
51-
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0",
52-
"phpunit/phpunit": "^9.6 || ^10.0"
51+
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
52+
"phpunit/phpunit": "^9.6 || ^10.0 || ^11.0"
53+
},
54+
"suggest": {
55+
"doctrine/dbal": "[For Laravel 8-10] Required to rename columns and drop SQLite columns (^3.5.1)."
5356
},
5457
"minimum-stability": "stable",
5558
"prefer-stable": true,
@@ -80,4 +83,4 @@
8083
]
8184
}
8285
}
83-
}
86+
}

phpunit.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,15 @@
1818
<include>
1919
<directory suffix=".php">./src</directory>
2020
</include>
21-
<report>
22-
<clover outputFile="build/logs/clover.xml"/>
23-
<html outputDirectory="build/logs/coverage"/>
24-
<text outputFile="build/logs/coverage.txt"/>
25-
</report>
2621
</coverage>
27-
<php>
28-
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
29-
<env name="DB_USERNAME" value="root"/>
30-
<env name="DB_PASSWORD" value="root"/>
31-
</php>
3222
<testsuites>
3323
<testsuite name="Test Suite">
3424
<directory suffix="Test.php">./tests</directory>
3525
</testsuite>
3626
</testsuites>
27+
<php>
28+
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
29+
<env name="DB_USERNAME" value="root"/>
30+
<env name="DB_PASSWORD" value="root"/>
31+
</php>
3732
</phpunit>

src/Console/Migrate.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Console;
46

57
use DragonCode\Contracts\MigrateDB\Builder;
@@ -135,9 +137,9 @@ protected function migrateTable(string $table, string $column): void
135137
$this->builder($this->source(), $table)
136138
->orderBy($column)
137139
->chunk(1000, function (Collection $items) use ($table) {
138-
$items = Arr::resolve($items);
139-
140-
$this->builder($this->target(), $table)->insert($items);
140+
$this->builder($this->target(), $table)->insert(
141+
Arr::resolve($items)
142+
);
141143
});
142144

143145
$this->migrated[] = $table;

src/Constants/Drivers.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Constants;
46

57
class Drivers

src/Database/Builder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Database;
46

57
use DragonCode\Contracts\MigrateDB\Builder as BuilderContract;
@@ -33,9 +35,13 @@ public function schema(): SchemaBuilder
3335

3436
public function getAllTables(): array
3537
{
38+
$schema = method_exists($this->schema(), 'getCurrentSchemaName')
39+
? $this->schema()->getCurrentSchemaName()
40+
: null;
41+
3642
$tables = method_exists($this->schema(), 'getAllTables')
3743
? $this->schema()->getAllTables()
38-
: $this->schema()->getTables();
44+
: $this->schema()->getTables($schema);
3945

4046
$key = $this->tableNameColumn();
4147

src/Database/Manager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Database;
46

57
use DragonCode\Contracts\MigrateDB\Builder as BuilderContract;

src/Database/MySQLBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Database;
46

57
class MySQLBuilder extends Builder

src/Database/PostgresBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace DragonCode\MigrateDB\Database;
46

57
class PostgresBuilder extends Builder

0 commit comments

Comments
 (0)