mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Fix broken tests due to Laravel change
This commit is contained in:
parent
8811688f8a
commit
e4da901ce5
4 changed files with 31 additions and 13 deletions
|
@ -74,7 +74,7 @@
|
|||
"@php artisan key:generate"
|
||||
],
|
||||
"test": [
|
||||
"@phpunit --colors=always"
|
||||
"phpunit --colors=always"
|
||||
],
|
||||
"analyze": [
|
||||
"phpstan analyse app --level=5"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Models\Artist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateVariousArtists extends Migration
|
||||
{
|
||||
|
@ -13,8 +14,11 @@ class CreateVariousArtists extends Migration
|
|||
public function up()
|
||||
{
|
||||
// Make sure modified artists cascade the album's artist_id field.
|
||||
Schema::table('albums', function ($table) {
|
||||
$table->dropForeign('albums_artist_id_foreign');
|
||||
Schema::table('albums', function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign('albums_artist_id_foreign');
|
||||
|
||||
}
|
||||
$table->foreign('artist_id')->references('id')->on('artists')->onUpdate('cascade')->onDelete('cascade');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CascadeDeleteUser extends Migration
|
||||
{
|
||||
|
@ -11,10 +12,13 @@ class CascadeDeleteUser extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('playlists', function ($table) {
|
||||
$table->dropForeign('playlists_user_id_foreign');
|
||||
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
|
||||
});
|
||||
Schema::table('playlists', function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign('playlists_user_id_foreign');
|
||||
}
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,8 +28,11 @@ class CascadeDeleteUser extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('playlists', function ($table) {
|
||||
$table->dropForeign('playlists_user_id_foreign');
|
||||
Schema::table('playlists', function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign('playlists_user_id_foreign');
|
||||
}
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameContributingArtistId extends Migration
|
||||
|
@ -12,8 +13,11 @@ class RenameContributingArtistId extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('songs', function ($table) {
|
||||
$table->dropForeign(['contributing_artist_id']);
|
||||
Schema::table('songs', function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(['contributing_artist_id']);
|
||||
}
|
||||
|
||||
$table->renameColumn('contributing_artist_id', 'artist_id');
|
||||
$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');
|
||||
});
|
||||
|
@ -26,8 +30,11 @@ class RenameContributingArtistId extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('songs', function ($table) {
|
||||
$table->dropForeign(['contributing_artist_id']);
|
||||
Schema::table('songs', function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(['contributing_artist_id']);
|
||||
}
|
||||
|
||||
$table->renameColumn('artist_id', 'contributing_artist_id');
|
||||
$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue