new: [flood protection] schema added

cli-modification-summary
iglocska 2022-02-07 01:59:58 +01:00
parent a9c1619bda
commit 6a2b764b97
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
use Migrations\AbstractMigration;
final class RegistrationFloodProtection extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$exists = $this->hasTable('flood_protections');
if (!$exists) {
$table = $this->table('flood_protections', [
'signed' => false,
'collation' => 'utf8mb4_unicode_ci',
]);
$table
->addColumn('remote_ip', 'string', [
'null' => false,
'length' => 45,
])
->addColumn('request_action', 'string', [
'null' => false,
'length' => 191,
])
->addColumn('expiration', 'integer', [
'null' => false,
'signed' => false,
'length' => 10,
])
->addIndex('remote_ip')
->addIndex('request_action')
->addIndex('expiration');
$table->create();
}
}
}