fix: playlist UUID migration

This commit is contained in:
Phan An 2024-03-12 11:48:57 +07:00
parent 7a4a6e4d98
commit 0710daca96
4 changed files with 7 additions and 13 deletions

View file

@ -146,8 +146,7 @@ OUTPUT_BIT_RATE=128
# environment, such a download will (silently) fail.
ALLOW_DOWNLOAD=true
# Whether to create a backup of a song instead of deleting it from the filesystem.
# If true, the song will simply be renamed into a .bak file.
# Whether to create a backup of a song when deleting it from the filesystem.
BACKUP_ON_DELETE=true
# Sync logs can be found under storage/logs/. Valid options are:

View file

@ -11,7 +11,7 @@ use Jackiedo\DotenvEditor\DotenvEditor;
class SetupLocalStorageCommand extends Command
{
protected $signature = 'koel:storage:local';
protected $description = 'Set up local storage for Koel';
protected $description = 'Set up the local storage for Koel';
public function __construct(private DotenvEditor $dotenvEditor)
{

View file

@ -1,6 +1,5 @@
<?php
use App\Models\Playlist;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
@ -27,16 +26,12 @@ return new class extends Migration {
$table->foreign('playlist_id')->references('id')->on('playlists')->cascadeOnDelete()->cascadeOnUpdate();
});
Playlist::all()->each(static function (Playlist $playlist): void {
DB::table('playlists')->get()->each(static function (object $playlist): void {
$oldId = $playlist->id;
$newId = Str::uuid()->toString();
$playlist->id = $newId;
$playlist->save();
DB::table('playlist_song')->where('playlist_id', $oldId)->update([
'playlist_id' => $newId,
]);
DB::table('playlists')->where('id', $oldId)->update(['id' => $newId]);
DB::table('playlist_song')->where('playlist_id', $oldId)->update(['playlist_id' => $newId]);
});
Schema::enableForeignKeyConstraints();

View file

@ -1,6 +1,6 @@
<template>
<div>
<div class="form-row" v-if="isPlus">
<div v-if="isPlus" class="form-row">
<label>
<CheckBox v-model="preferences.make_uploads_public" name="make_upload_public" />
Make uploaded songs public by default
@ -9,7 +9,7 @@
<div v-if="isPhone" class="form-row">
<label>
<CheckBox v-model="preferences.show_now_playing_notification" name="notify" />
Show Now Playing song notification
Show Now Playing notification
</label>
</div>
<div v-if="!isPhone" class="form-row">