Started diversion to not using image manager for cover/system/user

This commit is contained in:
Dan Brown
2019-04-27 14:55:23 +01:00
parent a87ae16010
commit cb832a2c10
8 changed files with 90 additions and 114 deletions

View File

@@ -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]);
}
}