Drop all triggers from database

This commit is contained in:
DariusIII
2025-01-30 12:38:15 +01:00
parent 7938e39c20
commit c048899138
5 changed files with 168 additions and 398 deletions
+4 -1
View File
@@ -445,10 +445,12 @@ class ProcessReleases
$determinedCategory = $categorize->determineCategory($collection->groups_id, $cleanedName);
$searchName = ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName;
$releaseID = Release::insertRelease(
[
'name' => $cleanRelName,
'searchname' => ! empty($cleanedName) ? mb_convert_encoding($cleanedName, 'UTF-8', mb_list_encodings()) : $cleanRelName,
'searchname' => $searchName,
'totalpart' => $collection->totalfiles,
'groups_id' => $collection->groups_id,
'guid' => createGUID(),
@@ -459,6 +461,7 @@ class ProcessReleases
'isrenamed' => $properName === true ? 1 : 0,
'predb_id' => $preID === false ? 0 : $preID,
'nzbstatus' => NZB::NZB_NONE,
'ishashed' => preg_match('/[a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64}/i', $searchName) ? 1 : 0,
]
);
+1
View File
@@ -136,6 +136,7 @@ class Release extends Model
'isrenamed' => $parameters['isrenamed'],
'iscategorized' => 1,
'predb_id' => $parameters['predb_id'],
'ishashed' => $parameters['ishashed'],
]
);
+1
View File
@@ -116,6 +116,7 @@ class ReleaseFile extends Model
'updated_at' => now()->timestamp,
'passworded' => $hasPassword,
'crc32' => $crc,
'ishashed' => preg_match('/[a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64}/i', $name) ? 1 : 0,
]);
} catch (\PDOException $e) {
Log::alert($e->getMessage());
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Drop triggers from releases, release_files and predb_hashes tables by using raw mysql queries
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_predb_insert_hashes_after_insert`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_predb_update_hashes_after_update`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_predb_delete_hashes_after_delete`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_release_files_check_rfinsert_before_insert`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_release_files_check_rfupdate_before_update`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_releases_check_insert_before_insert`');
DB::unprepared('DROP TRIGGER IF EXISTS `trigger_releases_check_update_before_update`');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
File diff suppressed because it is too large Load Diff