Skip to content

Commit

Permalink
make migration from old database error not found save
Browse files Browse the repository at this point in the history
  • Loading branch information
butburg committed Nov 10, 2024
1 parent 279d04f commit c643f38
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<?php

use Illuminate\Database\Migrations\Migration;
Expand Down Expand Up @@ -28,6 +29,17 @@ protected function getExtensionFromMimeType($mimeType)

public function up()
{
// check if old database exists
// Define the path to the old SQLite database
$oldDatabasePath = database_path('old_database.sqlite');

// Exit early if the old database file does not exist
if (!File::exists(database_path('old_database.sqlite'))) {
\Log::warning("The old database file at path {$oldDatabasePath} does not exist. Skipping related data migration.");
return;
}


// Fetch data from the old SQLite table
$oldPosts = DB::connection('old_sqlite')
->table('images')
Expand Down

0 comments on commit c643f38

Please sign in to comment.