fixing database connections
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Lucent\Record;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Database\Database;
|
||||
|
||||
class RecordRepo
|
||||
{
|
||||
@@ -14,7 +14,7 @@ class RecordRepo
|
||||
{
|
||||
$recordToDB = $record->toDB();
|
||||
|
||||
DB::table("records")->insert($recordToDB);
|
||||
Database::make()->table("records")->insert($recordToDB);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class RecordRepo
|
||||
*/
|
||||
public static function updateStatusBulk(Status $status, array $ids): void
|
||||
{
|
||||
DB::table("records")->whereIn("id", $ids)->update([
|
||||
Database::make()->table("records")->whereIn("id", $ids)->update([
|
||||
'status' => $status->value
|
||||
]);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class RecordRepo
|
||||
public static function update(Record $record): void
|
||||
{
|
||||
$recordToDB = $record->toDB();
|
||||
DB::table("records")->where("id", $record->id)->update($recordToDB);
|
||||
Database::make()->table("records")->where("id", $record->id)->update($recordToDB);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,17 +43,17 @@ class RecordRepo
|
||||
): void
|
||||
{
|
||||
|
||||
DB::table("records")->whereIn("id", $ids)->delete();
|
||||
DB::table("edges")->whereIn("source", $ids)->delete();
|
||||
DB::table("edges")->whereIn("target", $ids)->delete();
|
||||
DB::table("revisions")->whereIn("recordId", $ids)->delete();
|
||||
Database::make()->table("records")->whereIn("id", $ids)->delete();
|
||||
Database::make()->table("edges")->whereIn("source", $ids)->delete();
|
||||
Database::make()->table("edges")->whereIn("target", $ids)->delete();
|
||||
Database::make()->table("revisions")->whereIn("recordId", $ids)->delete();
|
||||
}
|
||||
|
||||
public function deleteTrashedBySchema(
|
||||
string $schemaName,
|
||||
): void
|
||||
{
|
||||
$ids = DB::table("records")
|
||||
$ids = Database::make()->table("records")
|
||||
->where("schema", $schemaName)
|
||||
->where("status", Status::TRASHED->value)
|
||||
->get()->pluck("id")->toArray();
|
||||
|
||||
Reference in New Issue
Block a user