feat: M2 database migration runner with Phinx and initial schema
This commit is contained in:
1 parent
d3e8cf8fae
commit
93d991703c
20 files changed
+2000
-14
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Config\Config;
|
||||
|
||||
/**
|
||||
* Phinx configuration for MeshVault database migrations.
|
||||
*
|
||||
* Uses environment variables from the application configuration (AppConfig)
|
||||
* for database connection. Migrations are stored in db/migrations/.
|
||||
*/
|
||||
|
||||
// Load environment from getenv() - Compose injects these into the container
|
||||
$dbHost = getenv('MESHVAULT_DB_HOST') ?: 'db';
|
||||
$dbPort = (int) (getenv('MESHVAULT_DB_PORT') ?: 5432);
|
||||
$dbName = getenv('MESHVAULT_DB_NAME') ?: 'meshvault';
|
||||
$dbUser = getenv('MESHVAULT_DB_USER') ?: 'meshvault';
|
||||
$dbPass = getenv('MESHVAULT_DB_PASSWORD') ?: '';
|
||||
|
||||
return [
|
||||
'paths' => [
|
||||
'migrations' => 'db/migrations',
|
||||
'seeds' => 'db/seeds',
|
||||
],
|
||||
'environments' => [
|
||||
'default_migration_table' => 'phinxlog',
|
||||
'default_database' => 'development',
|
||||
'development' => [
|
||||
'adapter' => 'pgsql',
|
||||
'host' => $dbHost,
|
||||
'port' => $dbPort,
|
||||
'name' => $dbName,
|
||||
'user' => $dbUser,
|
||||
'pass' => $dbPass,
|
||||
'charset' => 'utf8',
|
||||
],
|
||||
],
|
||||
'version_order' => 'creation',
|
||||
'migration_base_class' => 'Phinx\Migration\AbstractMigration',
|
||||
];
|
||||
Reference in new issue
Block a user