10000 [12.x] Add option to disable MySQL ssl when restoring or squashing mi… · laravel/framework@e0b397b · GitHub
[go: up one dir, main page]

Skip to content

Commit e0b397b

Browse files
[12.x] Add option to disable MySQL ssl when restoring or squashing migrations (#55683)
* Add option to disable mysql ssl when loading or squashing migrations * Update MySqlSchemaState.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent c089e30 commit e0b397b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Illuminate/Database/Schema/MySqlSchemaState.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ protected function connectionString()
115115
$value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"';
116116
}
117117

118+
if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT]) &&
119+
$config['options'][\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] === false) {
120+
$value .= ' --ssl=off';
121+
}
122+
118123
return $value;
119124
}
120125

tests/Database/DatabaseMySqlSchemaStateTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ public static function provider(): Generator
7070
],
7171
];
7272

73+
yield 'no_ssl' => [
74+
' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --ssl=off', [
75+
'LARAVEL_LOAD_SOCKET' => '',
76+
'LARAVEL_LOAD_HOST' => '',
77+
'LARAVEL_LOAD_PORT' => '',
78+
'LARAVEL_LOAD_USER' => 'root',
79+
'LARAVEL_LOAD_PASSWORD' => '',
80+
'LARAVEL_LOAD_DATABASE' => 'forge',
81+
'LARAVEL_LOAD_SSL_CA' => '',
82+
], [
83+
'username' => 'root',
84+
'database' => 'forge',
85+
'options' => [
86+
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
87+
],
88+
],
89+
];
90+
7391
yield 'unix socket' => [
7492
' --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --socket="${:LARAVEL_LOAD_SOCKET}"', [
7593
'LARAVEL_LOAD_SOCKET' => '/tmp/mysql.sock',

0 commit comments

Comments
 (0)
0