File tree Expand file tree Collapse file tree 3 files changed +25
-11
lines changed
Expand file tree Collapse file tree 3 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 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" ,
4342 "illuminate/contracts" : " ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0" ,
4746 "require-dev" : {
4847 "ext-pdo_mysql" : " *" ,
4948 "ext-pdo_pgsql" : " *" ,
49+ "doctrine/dbal" : " ^3.0 || ^4.0" ,
5050 "mockery/mockery" : " ^1.0" ,
5151 "orchestra/testbench" : " ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0" ,
5252 "phpunit/phpunit" : " ^9.6 || ^10.0 || ^11.0 || ^12.0"
5353 },
54+ "suggest" : {
55+ "doctrine/dbal" : " [For Laravel 8-10] Required to rename columns and drop SQLite columns (^3.5.1)."
56+ },
5457 "minimum-stability" : " stable" ,
5558 "prefer-stable" : true ,
5659 "autoload" : {
Original file line number Diff line number Diff line change 1717class Migrate extends Command
1818{
1919 protected $ signature = 'db:migrate '
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} ' ;
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} ' ;
2424
2525 protected $ description = 'Data transfer from one database to another ' ;
2626
@@ -135,9 +135,9 @@ protected function migrateTable(string $table, string $column): void
135135 $ this ->builder ($ this ->source (), $ table )
136136 ->orderBy ($ column )
137137 ->chunk (1000 , function (Collection $ items ) use ($ table ) {
138- $ items = Arr:: resolve ( $ items );
139-
140- $ this -> builder ( $ this -> target (), $ table )-> insertOrIgnore ( $ items );
138+ $ this -> builder ( $ this -> target (), $ table )-> updateOrInsert (
139+ Arr:: resolve ( $ items )
140+ );
141141 });
142142
143143 $ this ->migrated [] = $ table ;
Original file line number Diff line number Diff line change 22
33namespace Tests \Concerns ;
44
5+ use Illuminate \Foundation \Application ;
56use Illuminate \Support \Facades \DB ;
67use Illuminate \Support \Str ;
78
@@ -33,10 +34,20 @@ protected function fillTable(string $table): void
3334
3435 protected function fillUlidTable (string $ table ): void
3536 {
37+ $ ulids = [];
38+
39+ for ($ i = 0 ; $ i < 3 ; $ i ++) {
40+ $ ulids [$ i ] = (string ) Str::ulid ();
41+
42+ if (Str::startsWith (Application::VERSION , '12. ' )) {
43+ usleep (500 );
44+ }
45+ }
46+
3647 DB ::connection ($ this ->source_connection )->table ($ table )->insert ([
37- ['value ' => $ table . '_1 ' , 'ulid ' => ( string ) Str:: ulid () ],
38- ['value ' => $ table . '_2 ' , 'ulid ' => ( string ) Str:: ulid () ],
39- ['value ' => $ table . '_3 ' , 'ulid ' => ( string ) Str:: ulid () ],
48+ ['value ' => $ table . '_1 ' , 'ulid ' => $ ulids [ 0 ] ],
49+ ['value ' => $ table . '_2 ' , 'ulid ' => $ ulids [ 1 ] ],
50+ ['value ' => $ table . '_3 ' , 'ulid ' => $ ulids [ 2 ] ],
4051 ]);
4152 }
4253
You can’t perform that action at this time.
0 commit comments