odan/phinx-migrations-generator

Where can I find initial schema.php file?

TiredFingers opened this issue · 8 comments

Usage
Generating migrations
The first run generates an initial schema and a migration class. The file schema.php <== where is this file?

odan commented

See here.
The default value is: %%PHINX_CONFIG_DIR%%/db/migrations/schema.php.
You can change it with the schema_file option.

I would recommend placing the schema.php outside the phinx migrations path to prevent issues with the migrations.

Example:

// Phinx settings
$settings['phinx'] = [
    'paths' => [
        'migrations' => __DIR__  . '/../resources/migrations',
        'seeds' => __DIR__  . '/../resources/seeds',
    ],
    'default_migration_prefix' => '',
    'generate_migration_name' => true,
    'schema_file' => __DIR__ . '/../resources/schema/schema.php', // <---- here
    'environments' => [
        'default_migration_table' => 'phinxlog',
        'default_environment' => 'local',
        'local' => [],
    ],
];

Thanks, I saw this part of readme but after first generate call I don't have such. Is it ok?

odan commented

No, this is not Ok. Make sure that the path already exists.

odan commented

According to #98, it seems that your schema.php file now exists. Is this correct?

According to #98, it seems that your schema.php file now exists. Is this correct?

No but don't have enough time to play with. Thanks for the help, I will reopen if you recommendations will not help

I'm having a similar issue. Trying to use this to generate a starting point for using Phinx, and it doesn't create the schema file. The command ends in "aborted". Did I miss something in the setup?

figured it out: using the config setting "generate_migration_name" => true does not seem to work on the initial run. There was no helpful error message, the process just aborted. After I removed that, it prompted me and I was able to generate the schema and initial migration.

odan commented

@jordanfloyd Thank you for figuring that out. I will take a look at it if I have time.