PHP code example of nowo-tech / migrations-kit-contracts

1. Go to this page and download the library: Download nowo-tech/migrations-kit-contracts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nowo-tech / migrations-kit-contracts example snippets


use Nowo\MigrationsKitContracts\Collation\ExactKeyColumn;
use Nowo\MigrationsKitContracts\Collation\ExactKeyColumnsInterface;

final readonly class WorkflowExactKeyColumns implements ExactKeyColumnsInterface
{
    public function __construct(private TableNamePrefixer $prefixer, private bool $ownerTracking) {}

    public function exactKeyColumns(): array
    {
        return [
            // Resolve the table name the way the schema does: never a literal, or a host with a prefix
            // or a renamed table gets a false failure.
            new ExactKeyColumn($this->prefixer->applyPrefix('workflow_definition'), 'tenant_key',
                'nowo-tech/workflow-bundle', 'tenant key, compared with ='),

            // A column that only exists in an opt-in mode: declared inactive, reported as skipped, never failed.
            new ExactKeyColumn($this->prefixer->applyPrefix('workflow_owner_audit'), 'owner_id',
                'nowo-tech/workflow-bundle', 'host user id',
                'nowo_workflow.owner_tracking: true', $this->ownerTracking),
        ];
    }
}