@@ -230,6 +230,70 @@ public function testSame()
230230 );
231231 }
232232
233+ public function testUlidKeysAsPrimaryKey ()
234+ {
235+ if (! $ this ->hasUlid ()) {
236+ $ this ->assertTrue (true );
237+
238+ return ;
239+ }
240+
241+ $ this ->artisan ('migrate ' , [
242+ '--database ' => $ this ->source_connection ,
243+ '--realpath ' => true ,
244+ '--path ' => __DIR__ . '/../fixtures/primary_keys/2023_12_15_014834_create_ulid_primary_key.php ' ,
245+ ])->run ();
246+
247+ $ this ->fillUlidTable ($ this ->table_ulid );
248+
249+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_1 ' ], $ this ->source_connection );
250+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_2 ' ], $ this ->source_connection );
251+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_3 ' ], $ this ->source_connection );
252+
253+ $ this ->artisan ('db:migrate ' , [
254+ '--schema-from ' => $ this ->source_connection ,
255+ '--schema-to ' => $ this ->target_connection ,
256+ ])
257+ ->expectsConfirmation ('Please confirm table list should be retrieved from target connection? (incase if source connection does not support it) ' , 'no ' )
258+ ->expectsConfirmation ('Please confirm whether to truncate target table before transfer? ' , 'yes ' )
259+ ->expectsConfirmation ('Please choose whether to drop target tables before migration? ' , 'no ' )
260+ ->expectsChoice ('Please choose option to run migration on which connection? ' , $ this ->choice_source , $ this ->choices )
261+ ->assertExitCode (0 )
262+ ->run ();
263+
264+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_1 ' ], $ this ->target_connection );
265+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_2 ' ], $ this ->target_connection );
266+ $ this ->assertDatabaseHas ($ this ->table_ulid , ['value ' => $ this ->table_ulid . '_3 ' ], $ this ->target_connection );
267+ }
268+
269+ public function testUuidKeysAsPrimaryKey ()
270+ {
271+ if (! $ this ->hasUuid ()) {
272+ $ this ->assertTrue (true );
273+
274+ return ;
275+ }
276+
277+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_1 ' ], $ this ->source_connection );
278+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_2 ' ], $ this ->source_connection );
279+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_3 ' ], $ this ->source_connection );
280+
281+ $ this ->artisan ('db:migrate ' , [
282+ '--schema-from ' => $ this ->source_connection ,
283+ '--schema-to ' => $ this ->target_connection ,
284+ ])
285+ ->expectsConfirmation ('Please confirm table list should be retrieved from target connection? (incase if source connection does not support it) ' , 'no ' )
286+ ->expectsConfirmation ('Please confirm whether to truncate target table before transfer? ' , 'yes ' )
287+ ->expectsConfirmation ('Please choose whether to drop target tables before migration? ' , 'no ' )
288+ ->expectsChoice ('Please choose option to run migration on which connection? ' , $ this ->choice_source , $ this ->choices )
289+ ->assertExitCode (0 )
290+ ->run ();
291+
292+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_1 ' ], $ this ->target_connection );
293+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_2 ' ], $ this ->target_connection );
294+ $ this ->assertDatabaseHas ($ this ->table_uuid , ['value ' => $ this ->table_uuid . '_3 ' ], $ this ->target_connection );
295+ }
296+
233297 public function testFailed ()
234298 {
235299 $ this ->expectException (InvalidArgumentException::class);
0 commit comments