fix: handle redis_password in API database creation

The redis_password column was removed from standalone_redis table
in migration 2024_10_16_120026_move_redis_password_to_envs.php,
moving passwords to environment_variables table.

However, the API endpoint still accepted redis_password parameter
and tried to mass-assign it via fill(), causing SQL error:
"column redis_password of relation standalone_redis does not exist"

Fixed by extracting redis_password from $otherData before fill()
and using it when creating the REDIS_PASSWORD environment variable,
similar to how the migration handled the transition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-10-24 18:04:30 +02:00
parent 7a52fd4506
commit 53d0cc6839

View file

@ -41,7 +41,13 @@ function create_standalone_redis($environment_id, $destination_uuid, ?array $oth
$database = new StandaloneRedis;
$database->uuid = (new Cuid2);
$database->name = 'redis-database-'.$database->uuid;
$redis_password = \Illuminate\Support\Str::password(length: 64, symbols: false);
if ($otherData && isset($otherData['redis_password'])) {
$redis_password = $otherData['redis_password'];
unset($otherData['redis_password']);
}
$database->environment_id = $environment_id;
$database->destination_id = $destination->id;
$database->destination_type = $destination->getMorphClass();