snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.05k stars 3.18k forks source link

Snipe-IT version 6.4.2 to 7.0.12 Migrate Issue #15743

Open jaisanjay0 opened 2 days ago

jaisanjay0 commented 2 days ago

Debug mode

Describe the bug

We are using Snipe-IT version 6.4.2, and we are trying to upgrade to version 7.0.12, but the migration file (2024_07_26_143301_add_checkout_for_all_types_to_accessories) is not executing add checkout error

Reproduction steps

  1. We try to upgrade latest version one by one (migrate version : 7.0, 7.0.5, 7.0.8, 7.0.10 - successfully migrated) but ( 7.0.11, 7.0.12 and 7.0.13 - updated and migrate the file (add_checkout_for_all_types_to_accessories) migration is failed
  2. update composer and PHP version
  3. Latest version 7.0.13 installed then update the SQL file still same issue
  4. check Dependencies files.
  5. drop the accessories_checkout database and rename to accessories_userstoaccessories_checkout after migrating sub accessories item list is not showing
  6. generate to new APP_KEY

Expected behavior

attached logs file laravel.log

Screenshots

No response

Snipe-IT Version

6.4.2

Operating System

ubuntu 20.4

Web Server

Apache

PHP Version

8.3.7

Operating System

Windows 11

Browser

Chrome

Version

130.0.6723.70

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

[2024-10-28 16:50:10] production.ERROR: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'accessories_checkout' already exists (Connection: mysql, SQL: rename table `accessories_users` to `accessories_checkout`) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S01): SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'accessories_checkout' already exists (Connection: mysql, SQL: rename table `accessories_users` to `accessories_checkout`) at /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829)
[stacktrace]
#0 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\\Database\\Connection->runQueryCallback()
#1 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(576): Illuminate\\Database\\Connection->run()
#2 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\\Database\\Connection->statement()
#3 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\\Database\\Schema\\Blueprint->build()
#4 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(548): Illuminate\\Database\\Schema\\Builder->build()
#5 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Database\\Schema\\Builder->rename()
#6 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/database/migrations/2024_07_26_143301_add_checkout_for_all_types_to_accessories.php(18): Illuminate\\Support\\Facades\\Facade::__callStatic()
#7 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\\Database\\Migrations\\Migration@anonymous->up()
#8 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\\Database\\Migrations\\Migrator->runMethod()
#9 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#10 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->runMigration()
#11 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#12 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\\Console\\View\\Components\\Task->render()
#13 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->write()
#14 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\\Database\\Migrations\\Migrator->runUp()
#15 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\\Database\\Migrations\\Migrator->runPending()
#16 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(90): Illuminate\\Database\\Migrations\\Migrator->run()
#17 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#18 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(83): Illuminate\\Database\\Migrations\\Migrator->usingConnection()
#19 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle()
#20 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#21 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#22 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#23 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#24 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#25 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#26 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#27 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#28 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#29 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#30 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#31 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/artisan(33): Illuminate\\Foundation\\Console\\Kernel->handle()
#32 {main}

[previous exception] [object] (PDOException(code: 42S01): SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'accessories_checkout' already exists at /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php:587)
[stacktrace]
#0 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(587): PDOStatement->execute()
#1 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(816): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}()
#2 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\\Database\\Connection->runQueryCallback()
#3 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Connection.php(576): Illuminate\\Database\\Connection->run()
#4 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\\Database\\Connection->statement()
#5 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\\Database\\Schema\\Blueprint->build()
#6 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(548): Illuminate\\Database\\Schema\\Builder->build()
#7 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Database\\Schema\\Builder->rename()
#8 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/database/migrations/2024_07_26_143301_add_checkout_for_all_types_to_accessories.php(18): Illuminate\\Support\\Facades\\Facade::__callStatic()
#9 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\\Database\\Migrations\\Migration@anonymous->up()
#10 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\\Database\\Migrations\\Migrator->runMethod()
#11 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#12 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->runMigration()
#13 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#14 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\\Console\\View\\Components\\Task->render()
#15 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->write()
#16 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\\Database\\Migrations\\Migrator->runUp()
#17 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\\Database\\Migrations\\Migrator->runPending()
#18 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(90): Illuminate\\Database\\Migrations\\Migrator->run()
#19 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#20 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(83): Illuminate\\Database\\Migrations\\Migrator->usingConnection()
#21 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle()
#22 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#23 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#24 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#25 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#26 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#27 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#28 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run()
#29 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#30 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#31 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#32 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#33 /www/wwwroot/Testsession/Snipe-it/snipe-it-7.0.12/artisan(33): Illuminate\\Foundation\\Console\\Kernel->handle()
#34 {main}
"}

Additional context

No response

welcome[bot] commented 2 days ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 19 minutes ago

This usually means something in your migrations got donked up, which sometimes happens if there's output from a migration but the log file couldn't be written to, for example.

Try running this via command line SQL:

INSERT INTO migrations (migration, batch) VALUES ('2024_07_26_143301_add_checkout_for_all_types_to_accessories', 30);

then run migrations again and tell me what it says.