first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Configurazione Phinx per le tabelle LEGACY (senza prefisso).
|
||||
*
|
||||
* Divisione delle responsabilita':
|
||||
* - Laravel/Artisan -> tabelle Vanguard con prefisso "auth_" (registro: auth_migrations)
|
||||
* - Phinx -> tabelle legacy senza prefisso (registro: phinxlog)
|
||||
*
|
||||
* Le credenziali sono lette dal .env di Laravel tramite vlucas/phpdotenv,
|
||||
* senza bootstrappare tutto il framework: piu' leggero e indipendente.
|
||||
*/
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Carica il .env di Laravel in modo autonomo (senza avviare il framework)
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->safeLoad();
|
||||
|
||||
$env = fn(string $key, $default = null) => $_ENV[$key] ?? $_SERVER[$key] ?? $default;
|
||||
|
||||
$mysql = [
|
||||
'adapter' => 'mysql',
|
||||
'host' => $env('DB_HOST', 'localhost'),
|
||||
'name' => $env('DB_DATABASE'),
|
||||
'user' => $env('DB_USERNAME'),
|
||||
'pass' => $env('DB_PASSWORD', ''),
|
||||
'port' => (int) $env('DB_PORT', 3306),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
// Tabelle legacy SENZA prefisso: lasciato vuoto di proposito.
|
||||
'table_prefix' => '',
|
||||
];
|
||||
|
||||
return [
|
||||
'paths' => [
|
||||
'migrations' => __DIR__ . '/database/phinx/migrations',
|
||||
'seeds' => __DIR__ . '/database/phinx/seeds',
|
||||
],
|
||||
'environments' => [
|
||||
// Registro Phinx separato da quello di Laravel (auth_migrations).
|
||||
'default_migration_table' => 'phinxlog',
|
||||
'default_environment' => 'local',
|
||||
|
||||
'local' => $mysql,
|
||||
'test' => $mysql,
|
||||
'production' => $mysql,
|
||||
],
|
||||
'version_order' => 'creation',
|
||||
];
|
||||
Reference in New Issue
Block a user