diff --git a/app/Models/File.php b/app/Models/File.php index 911b1d1fd..615f85520 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -181,6 +181,7 @@ class File extends AbstractModel if ($this->share != $share) { AbstractModel::transaction(function () use ($share) { $this->share = $share; + $this->pshare = $share ? $this->id : 0; $this->save(); File::where("pids", "like", "%,{$this->id},%")->update(['pshare' => $share ? $this->id : 0]); if ($share === 0) { diff --git a/database/migrations/2023_04_01_164418_update_file_pshare.php b/database/migrations/2023_04_01_164418_update_file_pshare.php new file mode 100644 index 000000000..b7372739f --- /dev/null +++ b/database/migrations/2023_04_01_164418_update_file_pshare.php @@ -0,0 +1,26 @@ +wherePshare(0)->update(['pshare' => DB::raw('id')]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}