Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b6bec8

Browse files
Merge pull request#46 from TheDragonCode/3.x
Added support for `doctrine/dbal` and fix for Laravel 11
2 parents6738d45 +37b881a commit5b6bec8

File tree

8 files changed

+40
-21
lines changed

8 files changed

+40
-21
lines changed

‎.github/workflows/phpunit.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ jobs:
99
strategy:
1010
fail-fast:true
1111
matrix:
12-
php:[ "8.0", "8.1", "8.2", "8.3" ]
12+
php:[ "8.0", "8.1", "8.2", "8.3", "8.4" ]
1313
laravel:[ "8.0", "9.0", "10.0", "11.0" ]
14-
psql:[ "9", "10", "11", "12", "13", "14", "15" ]
14+
psql:[ "9", "10", "11", "12", "13", "14", "15", "16", "17" ]
1515
exclude:
1616
-laravel:"8.0"
1717
php:"8.3"
1818

19+
-laravel:"8.0"
20+
php:"8.4"
21+
1922
-laravel:"9.0"
2023
php:"8.3"
2124

25+
-laravel:"9.0"
26+
php:"8.4"
27+
2228
-laravel:"10.0"
2329
php:"8.0"
2430

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
3535
| Laravel| ^8.0, ^9.0, ^10.0, ^11.0|
3636
| Databases| MySQL 5.7+, PostgreSQL 9.5+, MSSQL|
3737

38-
| Laravel \ PostgreSQL| 9| 10| 11| 12| 13| 14| 15|
39-
|:---------------------|----|----|----|----|----|----|----|
40-
| 8||||||||
41-
| 9||||||||
42-
| 10||||||||
43-
| 11| ✖️| ✖️| ✖️|||||
38+
| Laravel \ PostgreSQL| 9| 10| 11| 12| 13| 14| 15| 16| 17|
39+
|:---------------------|----|----|----|----|----|----|----|----|----|
40+
| 8||||||||||
41+
| 9||||||||||
42+
| 10||||||||||
43+
| 11| ✖️| ✖️| ✖️|||||||
4444

4545

4646
##Usage

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"require": {
3838
"php":"^8.0",
3939
"ext-pdo":"*",
40-
"doctrine/dbal":"^3.0",
40+
"doctrine/dbal":"^3.0 || ^4.0",
4141
"dragon-code/contracts":"^2.15",
4242
"dragon-code/support":"^6.0",
4343
"illuminate/contracts":"^8.0 || ^9.0 || ^10.0 || ^11.0",

‎src/Console/Migrate.php‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
useDragonCode\MigrateDB\Facades\BuilderManager;
88
useDragonCode\Support\Facades\Helpers\Arr;
99
useIlluminate\Console\Command;
10+
useIlluminate\Database\Connection;
1011
useIlluminate\Database\Query\BuilderasQueryBuilder;
1112
useIlluminate\Support\Collection;
1213
useIlluminate\Support\Facades\DB;
@@ -16,10 +17,10 @@
1617
class Migrateextends Command
1718
{
1819
protected$signature ='db:migrate'
19-
.' {--schema-from= : Source connection name}'
20-
.' {--schema-to= : Target connection name}'
21-
.' {--exclude=* : Comma separated table names to exclude}'
22-
.' {--tables=* : Comma separated table names to migrate only}';
20+
.' {--schema-from= : Source connection name}'
21+
.' {--schema-to= : Target connection name}'
22+
.' {--exclude=* : Comma separated table names to exclude}'
23+
.' {--tables=* : Comma separated table names to migrate only}';
2324

2425
protected$description ='Data transfer from one database to another';
2526

@@ -252,7 +253,10 @@ protected function getMigrationOption(): string
252253

253254
protectedfunctionconfirmTableListOption():bool
254255
{
255-
return$this->confirm('Please confirm table list should be retrieved from target connection? (incase if source connection does not support it)',false);
256+
return$this->confirm(
257+
'Please confirm table list should be retrieved from target connection? (incase if source connection does not support it)',
258+
false
259+
);
256260
}
257261

258262
protectedfunctionconfirmTruncateTableOption():bool
@@ -311,7 +315,7 @@ protected function resolveOptions(): void
311315

312316
protectedfunctionbuilder(string$connection,string$table):QueryBuilder
313317
{
314-
returnDB::connection($connection)->table($table);
318+
return$this->connection($connection)->table($table);
315319
}
316320

317321
protectedfunctiondoesntHasTable(string$connection,string$table):bool
@@ -321,6 +325,15 @@ protected function doesntHasTable(string $connection, string $table): bool
321325

322326
protectedfunctiongetPrimaryKeyType(string$connection,string$table,string$column):string
323327
{
324-
returnDB::connection($connection)->getDoctrineColumn($table,$column)->getType()->getName();
328+
if (method_exists($this->connection($connection),'getDoctrineColumn')) {
329+
return$this->connection($connection)->getDoctrineColumn($table,$column)->getType()->getName();
330+
}
331+
332+
return$this->connection($connection)->getSchemaBuilder()->getColumnType($table,$column);
333+
}
334+
335+
protectedfunctionconnection(string$name):Connection
336+
{
337+
returnDB::connection($name);
325338
}
326339
}

‎src/Database/Builder.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(Connection $connection)
2424
}
2525

2626
/**
27-
* @return\Illuminate\Database\Schema\Builder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
27+
* @returnSchemaBuilder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
2828
*/
2929
publicfunctionschema():SchemaBuilder
3030
{

‎src/Database/Manager.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function get(): BuilderContract
3636
}
3737

3838
/**
39-
* @return\DragonCode\MigrateDB\Database\Builder|string
39+
* @return Builder|string
4040
*/
4141
protectedfunctiongetBuilder():string
4242
{

‎tests/Concerns/Connections.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ abstract protected function defaultSourceConnectionName(): string;
1818
abstractprotectedfunctiondefaultTargetConnectionName():string;
1919

2020
/**
21-
* @return\Illuminate\Database\Schema\Builder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
21+
* @return Builder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
2222
*/
2323
protectedfunctionsourceConnection():Builder
2424
{
2525
return Schema::connection($this->source_connection);
2626
}
2727

2828
/**
29-
* @return\Illuminate\Database\Schema\Builder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
29+
* @return Builder|\Illuminate\Database\Schema\MySqlBuilder|\Illuminate\Database\Schema\PostgresBuilder
3030
*/
3131
protectedfunctiontargetConnection():Builder
3232
{

‎tests/Configurations/Manager.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function get(string $driver): BaseConfiguration
2323
}
2424

2525
/**
26-
* @param string|\Tests\Configurations\BaseConfiguration $instance
26+
* @param string|BaseConfiguration $instance
2727
*/
2828
protectedfunctionresolve(string$instance):BaseConfiguration
2929
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp