Skip to content

Commit f98aeb1

Browse files
committed
Handle default table options in master slave connection.
1 parent 4285767 commit f98aeb1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/Configuration/Connections/MasterSlaveConnection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public function resolve(array $settings = [])
5151
$resolvedSettings['serverVersion'] = $settings['serverVersion'];
5252
}
5353

54+
if(!empty($settings['defaultTableOptions'])) {
55+
$resolvedSettings['defaultTableOptions'] = $settings['defaultTableOptions'];
56+
}
57+
5458
return $resolvedSettings;
5559
}
5660

tests/Configuration/Connections/MasterSlaveConnectionTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ private function getInputConfig()
9090
],
9191
],
9292
'serverVersion' => '5.8',
93+
'defaultTableOptions' => [
94+
'charset' => 'utf8mb4',
95+
'collate' => 'utf8mb4_unicode_ci',
96+
]
9397
];
9498
}
9599

@@ -136,6 +140,10 @@ private function getExpectedConfig()
136140
'unix_socket' => 'unix_socket',
137141
'prefix' => 'prefix'
138142
],
143+
'defaultTableOptions' => [
144+
'charset' => 'utf8mb4',
145+
'collate' => 'utf8mb4_unicode_ci',
146+
],
139147
];
140148
}
141149

@@ -221,6 +229,11 @@ private function getOracleExpectedConfig()
221229
$expectedConfigOracle['master']['user'] = 'homestead1';
222230
$expectedConfigOracle['serverVersion'] = '5.8';
223231

232+
$expectedConfigOracle['defaultTableOptions'] = [
233+
'charset' => 'utf8mb4',
234+
'collate' => 'utf8mb4_unicode_ci',
235+
];
236+
224237
return $expectedConfigOracle;
225238
}
226239

@@ -239,6 +252,11 @@ private function getPgsqlExpectedConfig()
239252
$expectedConfigPgsql['slaves'][1]['sslmode'] = 'sslmode';
240253
$expectedConfigPgsql['serverVersion'] = '5.8';
241254

255+
$expectedConfigPgsql['defaultTableOptions'] = [
256+
'charset' => 'utf8mb4',
257+
'collate' => 'utf8mb4_unicode_ci',
258+
];
259+
242260
return $expectedConfigPgsql;
243261
}
244262

@@ -277,6 +295,10 @@ private function getSqliteExpectedConfig()
277295
'path' => ':memory',
278296
],
279297
'serverVersion' => '5.8',
298+
'defaultTableOptions' => [
299+
'charset' => 'utf8mb4',
300+
'collate' => 'utf8mb4_unicode_ci',
301+
]
280302
];
281303
}
282304

0 commit comments

Comments
 (0)