phalcon / migrations

Generate or migrate database changes via migrations.
https://docs.phalcon.io/latest/en/db-migrations
BSD 3-Clause "New" or "Revised" License
28 stars 24 forks source link

[NFR] Support migration generation with timestamp based versions #144

Open dekiftw opened 11 months ago

dekiftw commented 11 months ago

The NFR format link isn't working so I'm going with the 'new issue' template. Regardless, this is a NFR to support migration generation with timestamp based versions.

Expected and Actual Behavior

Consider the following config file /app/config/migrations.php, with the following content:

<?php

declare(strict_types=1);

return [
    'application' => [
        'migrationsDir' => __DIR__ . '/database/migrations',
        'migrationsTsBased' => true,
    ],
    'database' => [
       // REDACTED
    ],
];

Expected

I expect that, when running:

vendor/bin/phalcon-migrations generate --config=/app/config/migrations.php

I would get (something like) the following output:

Phalcon Migrations

  Success: Version 1701806603960851 was successfully generated

Saying that a migration with a timestamp based version of 1701806603960851 was generated.

This behavior is the same even when the config file doesn't contain the migrationsTsBased setting but a command line argument is provided, like so:

vendor/bin/phalcon-migrations generate --config=/app/config/migrations.php --ts-based

Actual

For the same config file, running:

vendor/bin/phalcon-migrations generate --config=/app/config/migrations.php

gives the following output:

Phalcon Migrations

  Success: Version 1.0.0 was successfully generated

Saying that a migration with an incremental version of 1.0.0 was generated.

dekiftw commented 11 months ago

145