dbarzin / deming

Management tool for the information security management system / Outil de gestion du système de management de la sécurité de l'information
GNU General Public License v3.0
245 stars 62 forks source link

Can't Open domains after Update #216

Closed myndbreaker closed 2 weeks ago

myndbreaker commented 3 weeks ago

After updating to the latest release via git I get the following error when I try to open 'Configuration -> Domains'

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'domains.framework' in 'field list' (Connection: mysql, SQL: select `domains`.`id`, `domains`.`framework`, `domains`.`title`, `domains`.`description`, COUNT(measures.id) AS measures from `domains` left join `measures` on `measures`.`domain_id` = `domains`.`id` group by `domains`.`id` order by `domains`.`title` asc) 

I have no idea where to look for the error.

dbarzin commented 2 weeks ago

Have you migrated the database ?

php artisan migrate
myndbreaker commented 2 weeks ago

yes i did, when I run the command again I receive the following error:

2024_06_27_123923_add_control_measure_table ......................................................................... 1.95ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'control_measure' already exists (Connection: mysql, SQL: create table `control_measure` (`control_id` int unsigned not null, `measure_id` int unsigned not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕ 
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

      +9 vendor frames 

  10  database/migrations/2024_06_27_123923_add_control_measure_table.php:15
      Illuminate\Support\Facades\Facade::__callStatic()
      +25 vendor frames 

  36  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
dbarzin commented 2 weeks ago

Strange, It seems that this table has already been migrated but is not in the migrations table. Have you restored a backup without the migrations table ?

A quick fix would be to comment all the code in the up() method in the file database/migrations/2024_06_27_123923_add_control_measure_table.php Restart the migration and comment again on the next error until all migrations have been executed.

myndbreaker commented 2 weeks ago

Thanks a lot, the quick fix did the trick. I don't know what went wrong, but I can open the Domains again.