feat: CI/CD pipeline setup complete - Ansible playbooks updated, secrets configured, workflow ready
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Infrastructure\Database\Migrations;
|
||||
|
||||
use App\Framework\Database\Migration\Migration;
|
||||
use App\Framework\Database\ConnectionInterface;
|
||||
use App\Framework\Database\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Create component_state table for LiveComponents state persistence
|
||||
*
|
||||
* Stores current state of LiveComponents with metadata and tracking.
|
||||
* NOT reversible: Production table with user data - no safe rollback.
|
||||
*/
|
||||
final readonly class CreateComponentStateTable implements Migration
|
||||
{
|
||||
public function up(ConnectionInterface $connection): void
|
||||
{
|
||||
$schema = new Schema($connection);
|
||||
|
||||
$schema->create('component_state', function ($table) {
|
||||
// Primary Key
|
||||
$table->string('component_id', 255)->primary();
|
||||
|
||||
// State Data (encrypted)
|
||||
$table->text('state_data');
|
||||
$table->string('state_class', 255);
|
||||
|
||||
// Metadata
|
||||
$table->string('component_name', 255);
|
||||
$table->string('user_id', 255)->nullable();
|
||||
$table->string('session_id', 255)->nullable();
|
||||
|
||||
// Tracking
|
||||
$table->unsignedInteger('version')->default(1);
|
||||
$table->string('checksum', 64); // SHA256
|
||||
|
||||
// Timestamps
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
|
||||
// Indexes for performance
|
||||
$table->index('component_name', 'idx_component_state_name');
|
||||
$table->index('user_id', 'idx_component_state_user');
|
||||
$table->index('session_id', 'idx_component_state_session');
|
||||
$table->index('expires_at', 'idx_component_state_expires');
|
||||
$table->index('updated_at', 'idx_component_state_updated');
|
||||
});
|
||||
|
||||
$schema->execute();
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
{
|
||||
return '2024_12_20_120000';
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create component_state table for LiveComponents persistence';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Infrastructure\Database\Migrations;
|
||||
|
||||
use App\Framework\Database\Migration\Migration;
|
||||
use App\Framework\Database\ConnectionInterface;
|
||||
use App\Framework\Database\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Create component_state_history table for state change tracking
|
||||
*
|
||||
* Stores historical snapshots of component state changes for debugging,
|
||||
* analytics, and audit trails. Opt-in via #[TrackStateHistory] attribute.
|
||||
* NOT reversible: Historical data should be preserved.
|
||||
*/
|
||||
final readonly class CreateComponentStateHistoryTable implements Migration
|
||||
{
|
||||
public function up(ConnectionInterface $connection): void
|
||||
{
|
||||
$schema = new Schema($connection);
|
||||
|
||||
$schema->create('component_state_history', function ($table) {
|
||||
// Primary Key
|
||||
$table->id();
|
||||
|
||||
// Foreign Key to component_state
|
||||
$table->string('component_id', 255);
|
||||
|
||||
// State Data Snapshot
|
||||
$table->text('state_data');
|
||||
$table->string('state_class', 255);
|
||||
|
||||
// Version & Change Tracking
|
||||
$table->unsignedInteger('version');
|
||||
$table->enum('change_type', ['created', 'updated', 'deleted'])->default('updated');
|
||||
$table->json('changed_properties')->nullable(); // What changed
|
||||
|
||||
// Context
|
||||
$table->string('user_id', 255)->nullable();
|
||||
$table->string('session_id', 255)->nullable();
|
||||
$table->string('ip_address', 45)->nullable(); // IPv6 support
|
||||
$table->text('user_agent')->nullable();
|
||||
|
||||
// Checksums for integrity
|
||||
$table->string('previous_checksum', 64)->nullable();
|
||||
$table->string('current_checksum', 64);
|
||||
|
||||
// Timestamp
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
// Indexes for queries
|
||||
$table->index('component_id', 'idx_history_component');
|
||||
$table->index(['component_id', 'version'], 'idx_history_component_version');
|
||||
$table->index('created_at', 'idx_history_created');
|
||||
$table->index('change_type', 'idx_history_change_type');
|
||||
$table->index('user_id', 'idx_history_user');
|
||||
|
||||
// Foreign Key
|
||||
$table->foreign('component_id')
|
||||
->references('component_id')
|
||||
->on('component_state')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
$schema->execute();
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
{
|
||||
return '2024_12_20_120100';
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create component_state_history table for state change tracking';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user