mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-07-25 13:43:56 +03:00
Started diversion to not using image manager for cover/system/user
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class SetUserProfileImagesUploadedTo extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('images')
|
||||
->where('type', '=', 'user')
|
||||
->update([
|
||||
'uploaded_to' => DB::raw('`created_by`')
|
||||
]);
|
||||
|
||||
DB::table('images')
|
||||
->where('type', '=', 'cover')
|
||||
->update(['type' => 'cover_book']);
|
||||
|
||||
$firstBook = DB::table('books')->first(['id']);
|
||||
if ($firstBook) {
|
||||
DB::table('images')
|
||||
->where('type', '=', 'cover_book')
|
||||
->update(['uploaded_to' => $firstBook->id]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
DB::table('images')
|
||||
->where('type', '=', 'user')
|
||||
->update([
|
||||
'uploaded_to' => 0
|
||||
]);
|
||||
|
||||
DB::table('images')
|
||||
->where('type', '=', 'cover_book')
|
||||
->update(['type' => 'cover', 'uploaded_to' => 0]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user