update files script
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Lucent\Database\Database;
|
||||
|
||||
class UpgradeFiles122 extends Command
|
||||
{
|
||||
|
||||
protected $signature = 'lucent:upgrade:files_1_2_2 {schema} {disk}';
|
||||
protected $description = 'Upgrade to the new filesystem';
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$schema = $this->argument('schema');
|
||||
$disk = $this->argument('disk');
|
||||
$db = Database::make();
|
||||
$records = $db->table("records")->where("schema", $schema)->get();
|
||||
foreach ($records as $record) {
|
||||
$array = json_decode($record->_file, true);
|
||||
$array["disk"] = $disk;
|
||||
$db->table("records")->where("id", $record->id)->update(["_file" => json_encode($array)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use Lucent\Commands\LiveLink;
|
||||
use Lucent\Commands\RebuildThumbnails;
|
||||
use Lucent\Commands\RemoveOrphanEdges;
|
||||
use Lucent\Commands\SetupDatabase;
|
||||
use Lucent\Commands\UpgradeFiles122;
|
||||
use Lucent\File\FileService;
|
||||
use Lucent\File\ImageService;
|
||||
use Lucent\Query\DatabaseGraph\DatabaseGraph;
|
||||
@@ -79,6 +80,7 @@ class LucentServiceProvider extends ServiceProvider
|
||||
SetupDatabase::class,
|
||||
GenerateCollectionSchema::class,
|
||||
GenerateFileSchema::class,
|
||||
UpgradeFiles122::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class SchemaService
|
||||
name: $schemaArr["name"],
|
||||
label: $schemaArr["label"],
|
||||
fields: (new Collection($schemaArr["fields"]))->map([$this, 'mapFields']),
|
||||
disk: $schemaArr["disk"],
|
||||
disk: $schemaArr["disk"] ?? "lucent",
|
||||
path: $schemaArr["path"] ?? $schemaArr["name"],
|
||||
groups: $schemaArr["groups"] ?? [],
|
||||
isEntry: $schemaArr["isEntry"] ?? false,
|
||||
|
||||
Reference in New Issue
Block a user