Skip to content

Commit

Permalink
fix #1906 MySQL の厳格モードに対応
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Mar 5, 2023
1 parent 9f051a5 commit 87cafab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker/docker-compose.yml.default
Expand Up @@ -17,7 +17,7 @@ services:
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "basercms"
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --innodb-use-native-aio=0 --sql-mode=NO_ENGINE_SUBSTITUTION --default_authentication_plugin=mysql_native_password
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --innodb-use-native-aio=0 --default_authentication_plugin=mysql_native_password

bc5-php:
container_name: bc5-php
Expand Down
9 changes: 7 additions & 2 deletions plugins/baser-core/src/Service/BcDatabaseService.php
Expand Up @@ -682,7 +682,11 @@ public function loadCsvToArray($path, $encoding = 'auto')
}
$values = [];
foreach($record as $key => $value) {
$values[$head[$key]] = $value;
if(!$value) {
$values[$head[$key]] = null;
} else {
$values[$head[$key]] = $value;
}
}
$records[] = $values;
}
Expand Down Expand Up @@ -1219,7 +1223,8 @@ public function deleteTables($dbConfigKeyName = 'default', $dbConfig = null)
case 'mysql':
$sources = $db->getSchemaCollection()->listTables();
foreach($sources as $source) {
if (!preg_match("/^" . $prefix . "([^_].+)$/", $source)) continue;
if (!preg_match('/_phinxlog$/', $source) &&
!preg_match("/^" . $prefix . "([^_].+)$/", $source)) continue;
try {
$db->execute('DROP TABLE ' . $source);
} catch (BcException $e) {
Expand Down

0 comments on commit 87cafab

Please sign in to comment.