[GH-ISSUE #1774] Database migration fails on v7.0.0 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' #976

Closed
opened 2026-02-26 02:34:48 +03:00 by kerem · 5 comments
Owner

Originally created by @nebulade on GitHub (Jul 10, 2024).
Original GitHub issue: https://github.com/koel/koel/issues/1774

Describe the bug
Updating from 6.12.1 to 7.0.0 fails during database migration with:

'owner_id': used in a foreign key constraint 'songs_owner_id_foreign'

This happens on an instance which has one user and one song uploaded. A fresh 7.0.0 instance works fine.

Environment

  • Koel version7.0.0
  • OS: Cloudron
  • PHP version 8.1
  • Node version 18.18.0

Additional context
Crash logs from laravel.log:

[2024-07-10 16:09:55] production.ERROR: PDOException: SQLSTATE[HY000]: General error: 1832 Cannot change column 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' in /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php:587
Stack trace:
#0 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(587): PDOStatement->execute()
#1 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(816): Illuminate\Database\Connection->Illuminate\Database\{closure}()
#2 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\Database\Connection->runQueryCallback()
#3 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(588): Illuminate\Database\Connection->run()
#4 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\Database\Connection->statement()
#5 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\Database\Schema\Blueprint->build()
#6 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(444): Illuminate\Database\Schema\Builder->build()
#7 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Database\Schema\Builder->table()
#8 /app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php(32): Illuminate\Support\Facades\Facade::__callStatic()
#9 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\Database\Migrations\Migration@anonymous->up()
#10 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\Database\Migrations\Migrator->runMethod()
#11 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#12 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->runMigration()
#13 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#14 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\Console\View\Components\Task->render()
#15 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->write()
#16 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\Database\Migrations\Migrator->runUp()
#17 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\Database\Migrations\Migrator->runPending()
#18 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(92): Illuminate\Database\Migrations\Migrator->run()
#19 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\Database\Console\Migrations\MigrateCommand->Illuminate\Database\Console\Migrations\{closure}()
#20 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(104): Illuminate\Database\Migrations\Migrator->usingConnection()
#21 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Migrations\MigrateCommand->handle()
#22 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#23 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#24 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#25 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#26 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#27 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#28 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#29 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#30 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#31 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#32 /app/code/vendor/laravel/framework/src/Illuminate/Console/Application.php(163): Symfony\Component\Console\Application->run()
#33 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(400): Illuminate\Console\Application->call()
#34 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Foundation\Console\Kernel->call()
#35 /app/code/app/Console/Commands/InitCommand.php(273): Illuminate\Support\Facades\Facade::__callStatic()
#36 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): App\Console\Commands\InitCommand::App\Console\Commands\{closure}()
#37 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php(58): Illuminate\Console\View\Components\Task->render()
#38 /app/code/app/Console/Commands/InitCommand.php(274): Illuminate\Console\View\Components\Factory->__call()
#39 /app/code/app/Console/Commands/InitCommand.php(62): App\Console\Commands\InitCommand->migrateDatabase()
#40 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\InitCommand->handle()
#41 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#42 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#43 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#44 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#45 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#46 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#47 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#48 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#49 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#50 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#51 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run()
#52 /app/code/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#53 {main}

Next Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1832 Cannot change column 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' (Connection: mysql, SQL: ALTER TABLE songs CHANGE owner_id owner_id INT UNSIGNED NOT NULL) in /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
Stack trace:
#0 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\Database\Connection->runQueryCallback()
#1 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(588): Illuminate\Database\Connection->run()
#2 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\Database\Connection->statement()
#3 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\Database\Schema\Blueprint->build()
#4 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(444): Illuminate\Database\Schema\Builder->build()
#5 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Database\Schema\Builder->table()
#6 /app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php(32): Illuminate\Support\Facades\Facade::__callStatic()
#7 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\Database\Migrations\Migration@anonymous->up()
#8 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\Database\Migrations\Migrator->runMethod()
#9 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#10 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->runMigration()
#11 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}()
#12 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\Console\View\Components\Task->render()
#13 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->write()
#14 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\Database\Migrations\Migrator->runUp()
#15 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\Database\Migrations\Migrator->runPending()
#16 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(92): Illuminate\Database\Migrations\Migrator->run()
#17 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\Database\Console\Migrations\MigrateCommand->Illuminate\Database\Console\Migrations\{closure}()
#18 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(104): Illuminate\Database\Migrations\Migrator->usingConnection()
#19 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Migrations\MigrateCommand->handle()
#20 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#21 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#22 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#23 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#24 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#25 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#26 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#27 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#28 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#29 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#30 /app/code/vendor/laravel/framework/src/Illuminate/Console/Application.php(163): Symfony\Component\Console\Application->run()
#31 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(400): Illuminate\Console\Application->call()
#32 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Foundation\Console\Kernel->call()
#33 /app/code/app/Console/Commands/InitCommand.php(273): Illuminate\Support\Facades\Facade::__callStatic()
#34 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): App\Console\Commands\InitCommand::App\Console\Commands\{closure}()
#35 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php(58): Illuminate\Console\View\Components\Task->render()
#36 /app/code/app/Console/Commands/InitCommand.php(274): Illuminate\Console\View\Components\Factory->__call()
#37 /app/code/app/Console/Commands/InitCommand.php(62): App\Console\Commands\InitCommand->migrateDatabase()
#38 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\InitCommand->handle()
#39 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#40 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#41 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#42 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#43 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#44 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#45 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#46 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#47 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#48 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#49 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run()
#50 /app/code/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#51 {main}
Originally created by @nebulade on GitHub (Jul 10, 2024). Original GitHub issue: https://github.com/koel/koel/issues/1774 **Describe the bug** Updating from 6.12.1 to 7.0.0 fails during database migration with: ``` 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' ``` This happens on an instance which has one user and one song uploaded. A fresh 7.0.0 instance works fine. **Environment** - Koel version7.0.0 - OS: Cloudron - PHP version 8.1 - Node version 18.18.0 **Additional context** Crash logs from laravel.log: ``` [2024-07-10 16:09:55] production.ERROR: PDOException: SQLSTATE[HY000]: General error: 1832 Cannot change column 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' in /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php:587 Stack trace: #0 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(587): PDOStatement->execute() #1 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(816): Illuminate\Database\Connection->Illuminate\Database\{closure}() #2 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\Database\Connection->runQueryCallback() #3 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(588): Illuminate\Database\Connection->run() #4 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\Database\Connection->statement() #5 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\Database\Schema\Blueprint->build() #6 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(444): Illuminate\Database\Schema\Builder->build() #7 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Database\Schema\Builder->table() #8 /app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php(32): Illuminate\Support\Facades\Facade::__callStatic() #9 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\Database\Migrations\Migration@anonymous->up() #10 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\Database\Migrations\Migrator->runMethod() #11 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}() #12 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->runMigration() #13 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}() #14 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\Console\View\Components\Task->render() #15 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->write() #16 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\Database\Migrations\Migrator->runUp() #17 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\Database\Migrations\Migrator->runPending() #18 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(92): Illuminate\Database\Migrations\Migrator->run() #19 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\Database\Console\Migrations\MigrateCommand->Illuminate\Database\Console\Migrations\{closure}() #20 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(104): Illuminate\Database\Migrations\Migrator->usingConnection() #21 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Migrations\MigrateCommand->handle() #22 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #23 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() #24 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() #25 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call() #26 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call() #27 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute() #28 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run() #29 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run() #30 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #31 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #32 /app/code/vendor/laravel/framework/src/Illuminate/Console/Application.php(163): Symfony\Component\Console\Application->run() #33 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(400): Illuminate\Console\Application->call() #34 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Foundation\Console\Kernel->call() #35 /app/code/app/Console/Commands/InitCommand.php(273): Illuminate\Support\Facades\Facade::__callStatic() #36 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): App\Console\Commands\InitCommand::App\Console\Commands\{closure}() #37 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php(58): Illuminate\Console\View\Components\Task->render() #38 /app/code/app/Console/Commands/InitCommand.php(274): Illuminate\Console\View\Components\Factory->__call() #39 /app/code/app/Console/Commands/InitCommand.php(62): App\Console\Commands\InitCommand->migrateDatabase() #40 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\InitCommand->handle() #41 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #42 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() #43 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() #44 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call() #45 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call() #46 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute() #47 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run() #48 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run() #49 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #50 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #51 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run() #52 /app/code/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #53 {main} Next Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1832 Cannot change column 'owner_id': used in a foreign key constraint 'songs_owner_id_foreign' (Connection: mysql, SQL: ALTER TABLE songs CHANGE owner_id owner_id INT UNSIGNED NOT NULL) in /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 Stack trace: #0 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\Database\Connection->runQueryCallback() #1 /app/code/vendor/laravel/framework/src/Illuminate/Database/Connection.php(588): Illuminate\Database\Connection->run() #2 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php(110): Illuminate\Database\Connection->statement() #3 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(602): Illuminate\Database\Schema\Blueprint->build() #4 /app/code/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php(444): Illuminate\Database\Schema\Builder->build() #5 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Database\Schema\Builder->table() #6 /app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php(32): Illuminate\Support\Facades\Facade::__callStatic() #7 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): Illuminate\Database\Migrations\Migration@anonymous->up() #8 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\Database\Migrations\Migrator->runMethod() #9 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(419): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}() #10 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->runMigration() #11 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\Database\Migrations\Migrator->Illuminate\Database\Migrations\{closure}() #12 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\Console\View\Components\Task->render() #13 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\Database\Migrations\Migrator->write() #14 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\Database\Migrations\Migrator->runUp() #15 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\Database\Migrations\Migrator->runPending() #16 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(92): Illuminate\Database\Migrations\Migrator->run() #17 /app/code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\Database\Console\Migrations\MigrateCommand->Illuminate\Database\Console\Migrations\{closure}() #18 /app/code/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(104): Illuminate\Database\Migrations\Migrator->usingConnection() #19 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Migrations\MigrateCommand->handle() #20 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #21 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() #22 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() #23 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call() #24 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call() #25 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute() #26 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run() #27 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run() #28 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #29 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #30 /app/code/vendor/laravel/framework/src/Illuminate/Console/Application.php(163): Symfony\Component\Console\Application->run() #31 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(400): Illuminate\Console\Application->call() #32 /app/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\Foundation\Console\Kernel->call() #33 /app/code/app/Console/Commands/InitCommand.php(273): Illuminate\Support\Facades\Facade::__callStatic() #34 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): App\Console\Commands\InitCommand::App\Console\Commands\{closure}() #35 /app/code/vendor/laravel/framework/src/Illuminate/Console/View/Components/Factory.php(58): Illuminate\Console\View\Components\Task->render() #36 /app/code/app/Console/Commands/InitCommand.php(274): Illuminate\Console\View\Components\Factory->__call() #37 /app/code/app/Console/Commands/InitCommand.php(62): App\Console\Commands\InitCommand->migrateDatabase() #38 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\InitCommand->handle() #39 /app/code/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #40 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure() #41 /app/code/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod() #42 /app/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call() #43 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call() #44 /app/code/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute() #45 /app/code/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run() #46 /app/code/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run() #47 /app/code/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #48 /app/code/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #49 /app/code/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run() #50 /app/code/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #51 {main} ```
kerem closed this issue 2026-02-26 02:34:48 +03:00
Author
Owner

@phanan commented on GitHub (Jul 10, 2024):

Thanks for the report. What's the DB you're using?

<!-- gh-comment-id:2221128501 --> @phanan commented on GitHub (Jul 10, 2024): Thanks for the report. What's the DB you're using?
Author
Owner

@nebulade commented on GitHub (Jul 10, 2024):

Oh sorry didn't mention that. This is on mysql v8.

<!-- gh-comment-id:2221133336 --> @nebulade commented on GitHub (Jul 10, 2024): Oh sorry didn't mention that. This is on mysql v8.
Author
Owner

@phanan commented on GitHub (Jul 10, 2024):

If you remove line 31 in /app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php and run the migration, what'll happen?

<!-- gh-comment-id:2221141630 --> @phanan commented on GitHub (Jul 10, 2024): If you remove line 31 in `/app/code/database/migrations/2024_01_03_104241_support_multi_tenant.php` and run the migration, what'll happen?
Author
Owner

@nebulade commented on GitHub (Jul 11, 2024):

Thanks for resolving this so quickly. I can confirm, removing that line fixed the issue.

<!-- gh-comment-id:2222602668 --> @nebulade commented on GitHub (Jul 11, 2024): Thanks for resolving this so quickly. I can confirm, removing that line fixed the issue.
Author
Owner

@phanan commented on GitHub (Jul 11, 2024):

Glad it works!

<!-- gh-comment-id:2222608289 --> @phanan commented on GitHub (Jul 11, 2024): Glad it works!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#976
No description provided.