- 134-tool registry with programmatic SEO (unique titles/H1/descriptions, JSON-LD graphs, sitemap index, canonical 301 enforcement via required filter) - DB-backed job queue (SKIP LOCKED) with drivers: Ffmpeg, Images (GD), Pdf (qpdf/gs/poppler), Youtube (thumbnails), Qr (server-side PNG) - Security: SSRF guard, MIME validation, rate limits, API-key auth, bcrypt admin login, security headers - Admin panel: dashboard, tools/categories/guides CRUD, SEO audit, analytics, job inspector with retry, system health, feature flags - Docker deployment (nginx + web/api FPM pools + scalable workers), PHPUnit suite (19 tests / 1139 assertions), PWA manifest + service worker
43 lines
1.7 KiB
PHP
43 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
final class CreateApiKeys extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$this->forge->addField([
|
|
'id' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
|
|
'name' => ['type' => 'VARCHAR', 'constraint' => 100],
|
|
// only a salted hash is stored; the plaintext token is shown once at creation
|
|
'key_hash' => ['type' => 'VARCHAR', 'constraint' => 64],
|
|
'key_prefix' => ['type' => 'VARCHAR', 'constraint' => 12],
|
|
'rate_limit_per_hour' => ['type' => 'INT', 'unsigned' => true, 'default' => 120],
|
|
'request_count' => ['type' => 'BIGINT', 'unsigned' => true, 'default' => 0],
|
|
'is_active' => ['type' => 'TINYINT', 'constraint' => 1, 'default' => 1],
|
|
'last_used_at' => ['type' => 'DATETIME', 'null' => true],
|
|
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->addPrimaryKey('id');
|
|
$this->forge->addUniqueKey('key_hash');
|
|
$this->forge->createTable('api_keys', true);
|
|
|
|
$this->forge->addField([
|
|
'key' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
|
'value' => ['type' => 'TEXT'],
|
|
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->createTable('settings', true);
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropTable('api_keys', true);
|
|
$this->forge->dropTable('settings', true);
|
|
}
|
|
}
|