improve migrate searchbox log

This commit is contained in:
xiaomlove
2022-10-29 00:34:54 +08:00
parent 6e76f6be54
commit 8bc9a84392
2 changed files with 6 additions and 2 deletions

View File

@@ -90,8 +90,8 @@ class Test extends Command
*/
public function handle()
{
$r = SearchBox::getSubCatOptions();
dd($r);
$columnInfo = NexusDB::getMysqlColumnInfo('searchbox', 'section_name');
dd($columnInfo);
}

View File

@@ -262,12 +262,16 @@ class Update extends Install
$shouldMigrateSearchBox = false;
if (!NexusDB::hasColumn('searchbox', 'section_name')) {
$shouldMigrateSearchBox = true;
$searchBoxLog = "no section_name field";
} else {
$columnInfo = NexusDB::getMysqlColumnInfo('searchbox', 'section_name');
$searchBoxLog = "has section_name, searchbox.section DATA_TYPE: " . $columnInfo['DATA_TYPE'];
if ($columnInfo['DATA_TYPE'] != 'json') {
$searchBoxLog .= ", not json";
$shouldMigrateSearchBox = true;
}
}
$this->doLog("$searchBoxLog, shouldMigrateSearchBox: $shouldMigrateSearchBox");
if ($shouldMigrateSearchBox) {
$this->runMigrate('database/migrations/2022_09_05_230532_add_mode_to_section_related.php');
$this->runMigrate('database/migrations/2022_09_06_004318_add_section_name_to_searchbox_table.php');