Update triggers and packages used

This commit is contained in:
DariusIII
2022-03-17 22:00:59 +01:00
parent 3c4a41c134
commit b4e088afe8
11 changed files with 32 additions and 236 deletions
Generated
+5 -5
View File
@@ -16489,16 +16489,16 @@
},
{
"name": "spatie/laravel-ignition",
"version": "1.0.9",
"version": "1.0.10",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "d7b223300d511145eea87fdabae1663c7c0088aa"
"reference": "71df77cad94aae4db904aaef1cc2f06950daed76"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/d7b223300d511145eea87fdabae1663c7c0088aa",
"reference": "d7b223300d511145eea87fdabae1663c7c0088aa",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/71df77cad94aae4db904aaef1cc2f06950daed76",
"reference": "71df77cad94aae4db904aaef1cc2f06950daed76",
"shasum": ""
},
"require": {
@@ -16572,7 +16572,7 @@
"type": "github"
}
],
"time": "2022-03-11T14:19:27+00:00"
"time": "2022-03-17T11:01:36+00:00"
},
{
"name": "symfony/config",
@@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Triggers\Trigger;
class CreateReleasesTable extends Migration
{
@@ -81,6 +82,13 @@ processed');
DB::statement('ALTER TABLE releases DROP PRIMARY KEY , ADD PRIMARY KEY (id, categories_id)');
DB::statement('ALTER TABLE releases ADD COLUMN nzb_guid BINARY(16) NULL');
DB::statement('ALTER TABLE releases ADD INDEX ix_releases_nzb_guid (nzb_guid)');
Trigger::table('releases')->key('check_insert')->beforeInsert(function () {
return 'IF NEW.searchname REGEXP "[a-fA-F0-9]{32}" OR NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
});
Trigger::table('releases')->key('check_update')->beforeUpdate(function () {
return 'IF NEW.searchname REGEXP "[a-fA-F0-9]{32}" OR NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
});
}
/**
@@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Triggers\Trigger;
class CreatePredbTable extends Migration
{
@@ -33,6 +34,15 @@ class CreatePredbTable extends Migration
$table->index(['requestid', 'groups_id'], 'ix_predb_requestid');
});
DB::statement('ALTER TABLE predb ADD FULLTEXT ft_predb_filename (filename)');
Trigger::table('predb')->key('insert_hashes')->afterInsert(function () {
return 'INSERT INTO predb_hashes (hash, predb_id) VALUES (UNHEX(MD5(NEW.title)), NEW.id), (UNHEX(MD5(MD5(NEW.title))), NEW.id), (UNHEX(SHA1(NEW.title)), NEW.id), (UNHEX(SHA2(NEW.title, 256)), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid))), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid, NEW.requestid))), NEW.id);';
});
Trigger::table('predb')->key('update_hashes')->afterUpdate(function () {
return 'IF NEW.title != OLD.title THEN DELETE FROM predb_hashes WHERE hash IN ( UNHEX(md5(OLD.title)), UNHEX(md5(md5(OLD.title))), UNHEX(sha1(OLD.title)), UNHEX(sha2(OLD.title, 256)), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid)))) AND predb_id = OLD.id; INSERT INTO predb_hashes (hash, predb_id) VALUES (UNHEX(MD5(NEW.title)), NEW.id), (UNHEX(MD5(MD5(NEW.title))), NEW.id), (UNHEX(SHA1(NEW.title)), NEW.id), (UNHEX(SHA2(NEW.title, 256)), NEW.id), (UNHEX(MD5(CONCAT((NEW.title, NEW.requestid)))), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid, NEW.requestid))), NEW.id);END IF;';
});
Trigger::table('predb')->key('delete_hashes')->afterDelete(function () {
return 'DELETE FROM predb_hashes WHERE hash IN ( UNHEX(md5(OLD.title)), UNHEX(md5(md5(OLD.title))), UNHEX(sha1(OLD.title)), UNHEX(sha2(OLD.title, 256)), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid))), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid, OLD.requestid)))) AND predb_id = OLD.id;';
});
}
/**
@@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Triggers\Trigger;
class CreateReleaseFilesTable extends Migration
{
@@ -26,6 +27,14 @@ class CreateReleaseFilesTable extends Migration
$table->primary(['releases_id', 'name']);
$table->foreign('releases_id', 'FK_rf_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
});
Trigger::table('release_files')->key('check_rfinsert')->beforeInsert(function () {
return 'IF NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
});
Trigger::table('release_files')->key('check_rfupdate')->beforeUpdate(function () {
return 'IF NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
});
}
/**
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateCheckInsertTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('check_insert')
->on('releases')
->statement(function () {
return 'IF NEW.searchname REGEXP "[a-fA-F0-9]{32}" OR NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
})
->before()
->insert();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('releases.check_insert');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateCheckUpdateTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('check_update')
->on('releases')
->statement(function () {
return 'IF NEW.searchname REGEXP "[a-fA-F0-9]{32}" OR NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
})
->before()
->update();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('releases.check_update');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateCheckRfinsertTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('check_rfinsert')
->on('release_files')
->statement(function () {
return 'IF NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
})
->before()
->insert();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('release_files.check_rfinsert');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateCheckRfupdateTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('check_rfupdate')
->on('release_files')
->statement(function () {
return 'IF NEW.name REGEXP "[a-fA-F0-9]{32}" THEN SET NEW.ishashed = 1; END IF;';
})
->before()
->update();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('release_files.check_rfupdate');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateInsertHashesTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('insert_hashes')
->on('predb')
->statement(function () {
return 'INSERT INTO predb_hashes (hash, predb_id) VALUES (UNHEX(MD5(NEW.title)), NEW.id), (UNHEX(MD5(MD5(NEW.title))), NEW.id), (UNHEX(SHA1(NEW.title)), NEW.id), (UNHEX(SHA2(NEW.title, 256)), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid))), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid, NEW.requestid))), NEW.id);';
})
->after()
->insert();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('predb.insert_hashes');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateUpdateHashesTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('update_hashes')
->on('predb')
->statement(function () {
return 'IF NEW.title != OLD.title THEN DELETE FROM predb_hashes WHERE hash IN ( UNHEX(md5(OLD.title)), UNHEX(md5(md5(OLD.title))), UNHEX(sha1(OLD.title)), UNHEX(sha2(OLD.title, 256)), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid)))) AND predb_id = OLD.id; INSERT INTO predb_hashes (hash, predb_id) VALUES (UNHEX(MD5(NEW.title)), NEW.id), (UNHEX(MD5(MD5(NEW.title))), NEW.id), (UNHEX(SHA1(NEW.title)), NEW.id), (UNHEX(SHA2(NEW.title, 256)), NEW.id), (UNHEX(MD5(CONCAT((NEW.title, NEW.requestid)))), NEW.id), (UNHEX(MD5(CONCAT(NEW.title, NEW.requestid, NEW.requestid))), NEW.id);END IF;';
})
->after()
->update();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('predb.update_hashes');
}
}
@@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use NtimYeboah\LaravelDatabaseTrigger\TriggerFacade as Schema;
class CreateDeleteHashesTrigger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('delete_hashes')
->on('predb')
->statement(function () {
return 'DELETE FROM predb_hashes WHERE hash IN ( UNHEX(md5(OLD.title)), UNHEX(md5(md5(OLD.title))), UNHEX(sha1(OLD.title)), UNHEX(sha2(OLD.title, 256)), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid))), UNHEX(MD5(CONCAT(OLD.title, OLD.requestid, OLD.requestid)))) AND predb_id = OLD.id;';
})
->after()
->delete();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('predb.delete_hashes');
}
}