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
+2 -2
View File
@@ -90,8 +90,8 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$r = SearchBox::getSubCatOptions(); $columnInfo = NexusDB::getMysqlColumnInfo('searchbox', 'section_name');
dd($r); dd($columnInfo);
} }
+4
View File
@@ -262,12 +262,16 @@ class Update extends Install
$shouldMigrateSearchBox = false; $shouldMigrateSearchBox = false;
if (!NexusDB::hasColumn('searchbox', 'section_name')) { if (!NexusDB::hasColumn('searchbox', 'section_name')) {
$shouldMigrateSearchBox = true; $shouldMigrateSearchBox = true;
$searchBoxLog = "no section_name field";
} else { } else {
$columnInfo = NexusDB::getMysqlColumnInfo('searchbox', 'section_name'); $columnInfo = NexusDB::getMysqlColumnInfo('searchbox', 'section_name');
$searchBoxLog = "has section_name, searchbox.section DATA_TYPE: " . $columnInfo['DATA_TYPE'];
if ($columnInfo['DATA_TYPE'] != 'json') { if ($columnInfo['DATA_TYPE'] != 'json') {
$searchBoxLog .= ", not json";
$shouldMigrateSearchBox = true; $shouldMigrateSearchBox = true;
} }
} }
$this->doLog("$searchBoxLog, shouldMigrateSearchBox: $shouldMigrateSearchBox");
if ($shouldMigrateSearchBox) { if ($shouldMigrateSearchBox) {
$this->runMigrate('database/migrations/2022_09_05_230532_add_mode_to_section_related.php'); $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'); $this->runMigrate('database/migrations/2022_09_06_004318_add_section_name_to_searchbox_table.php');