Skip to content

Commit

Permalink
Merge branch '10.x' into 11.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	src/Illuminate/Foundation/Application.php
  • Loading branch information
driesvints committed Jun 21, 2024
2 parents d68f493 + b8aca98 commit 9c7ca00
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Schema/MySqlSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function dump(Connection $connection, $path)

$this->removeAutoIncrementingState($path);

$this->appendMigrationData($path);
if ($this->hasMigrationTable()) {
$this->appendMigrationData($path);
}
}

/**
Expand Down
5 changes: 4 additions & 1 deletion Schema/PostgresSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public function dump(Connection $connection, $path)
{
$commands = collect([
$this->baseDumpCommand().' --schema-only > '.$path,
$this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path,
]);

if ($this->hasMigrationTable()) {
$commands->push($this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path);
}

$commands->map(function ($command, $path) {
$this->makeProcess($command)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
'LARAVEL_LOAD_PATH' => $path,
Expand Down
10 changes: 10 additions & 0 deletions Schema/SchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ public function makeProcess(...$arguments)
return call_user_func($this->processFactory, ...$arguments);
}

/**
* Determine if the current connection has a migration table.
*
* @return bool
*/
public function hasMigrationTable(): bool
{
return $this->connection->getSchemaBuilder()->hasTable($this->migrationTable);
}

/**
* Specify the name of the application's migration table.
*
Expand Down
4 changes: 3 additions & 1 deletion Schema/SqliteSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public function dump(Connection $connection, $path)

$this->files->put($path, implode(PHP_EOL, $migrations).PHP_EOL);

$this->appendMigrationData($path);
if ($this->hasMigrationTable()) {
$this->appendMigrationData($path);
}
}

/**
Expand Down

0 comments on commit 9c7ca00

Please sign in to comment.