PHP code example of clcbws / laravel-schema-sentinel

1. Go to this page and download the library: Download clcbws/laravel-schema-sentinel 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/ */

    

clcbws / laravel-schema-sentinel example snippets


use Sentinel\SchemaSentinel\Facades\Sentinel;

$diff = Sentinel::check(strict: true);

if ($diff->hasDifferences()) {
    // Schema has drifted
    $healthScore = $diff->getHealthScore();
    $missingTables = $diff->missingTables;
}

$tables = Sentinel::parse(); // Returns array of TableDefinition DTOs

$results = Sentinel::standardizeIndexes();
// Returns array with 'deviations' and 'redundant' indexes

$dataDrift = Sentinel::dataDrift('production');

$results = Sentinel::reverse([
    'path' => base_path('exports'),
    'models' => true,
    'migrations' => true,
    'seeders' => false,
    'enums' => true,
]);
bash
php artisan vendor:publish --tag="schema-sentinel-config"
bash
php artisan schema:drift
bash
php artisan schema:standardize-indexes
bash
php artisan schema:reverse --path=./exports
bash
php artisan schema:sentinel-lint
bash
php artisan schema:sentinel-doctor
bash
php artisan schema:help drft