1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Revamped image system to use driver-agnotstic storage and be more efficent

This commit is contained in:
Dan Brown
2015-12-07 23:00:34 +00:00
parent 46c905df8a
commit c88096b7e2
12 changed files with 557 additions and 144 deletions

View File

@ -0,0 +1,41 @@
<?php
use BookStack\Image;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddImageUploadTypes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('images', function (Blueprint $table) {
$table->string('path', 400);
$table->string('type')->index();
});
Image::all()->each(function($image) {
$image->path = $image->url;
$image->type = 'gallery';
$image->save();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('images', function (Blueprint $table) {
$table->dropColumn('type');
$table->dropColumn('path');
});
}
}