[GH-ISSUE #675] Error migrating Database on install #481

Closed
opened 2026-02-26 02:33:20 +03:00 by kerem · 2 comments
Owner

Originally created by @Mattssn111 on GitHub (Nov 2, 2017).
Original GitHub issue: https://github.com/koel/koel/issues/675

Hello, I have gone through two different guides and everything seems to be fine with the installation, I get through almost everything but then when it comes time to run php artisan koel:init it tries to run the migration then the following occurs, I have tried this multiple times. I am running Centos 7.

Attempting to install or upgrade Koel.
Remember, you can always install/upgrade manually following the guide here:
📙  https://koel.phanan.net/docs
App key exists -- skipping
JWT secret exists -- skipping
Migrating database


  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150) (SQL: ALTER TABLE songs
   CHANGE contributing_artist_id artist_id INT UNSIGNED DEFAULT NULL)



  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150)



  [PDOException]
  SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150)```

Originally created by @Mattssn111 on GitHub (Nov 2, 2017). Original GitHub issue: https://github.com/koel/koel/issues/675 Hello, I have gone through two different guides and everything seems to be fine with the installation, I get through almost everything but then when it comes time to run ```php artisan koel:init``` it tries to run the migration then the following occurs, I have tried this multiple times. I am running Centos 7. ```[root@centos html]# php artisan koel:init Attempting to install or upgrade Koel. Remember, you can always install/upgrade manually following the guide here: 📙 https://koel.phanan.net/docs App key exists -- skipping JWT secret exists -- skipping Migrating database [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150) (SQL: ALTER TABLE songs CHANGE contributing_artist_id artist_id INT UNSIGNED DEFAULT NULL) [Doctrine\DBAL\Driver\PDOException] SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150) [PDOException] SQLSTATE[HY000]: General error: 1025 Error on rename of './koel/#sql-57c_c' to './koel/songs' (errno: 150)```
kerem closed this issue 2026-02-26 02:33:20 +03:00
Author
Owner

@blackstar0169 commented on GitHub (Nov 28, 2017):

Hello, I have the same issue.
php artisan install finished with success.
Runing on Debian 9, nginx 1.6.2, mysql ver 14.14 Distrib 5.5.58

<!-- gh-comment-id:347677831 --> @blackstar0169 commented on GitHub (Nov 28, 2017): Hello, I have the same issue. php artisan install finished with success. Runing on Debian 9, nginx 1.6.2, mysql ver 14.14 Distrib 5.5.58
Author
Owner

@blackstar0169 commented on GitHub (Nov 28, 2017):

Ok I found the issue.
In database/migrations/2017_04_29_025836_rename_contributing_artist_id.php :
add : $table->dropForeign(['contributing_artist_id']); before the $table->renameColumn... line
and add : $table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade'); after the $table->renameColumn... line

I hope it will work for you.

<!-- gh-comment-id:347685828 --> @blackstar0169 commented on GitHub (Nov 28, 2017): Ok I found the issue. In database/migrations/2017_04_29_025836_rename_contributing_artist_id.php : add : `$table->dropForeign(['contributing_artist_id']);` **before** the `$table->renameColumn...` line and add : `$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');` **after** the `$table->renameColumn...` line I hope it will work for you.
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#481
No description provided.