phinx icon indicating copy to clipboard operation
phinx copied to clipboard

Migrate using target throws warning

Open LeftPinkie opened this issue 5 years ago • 4 comments

When I am migrating using --target 2012, I get a warning

warning 2012 is not a valid version

However, will work if I use the full date/time, eg --date 2012010308.

LeftPinkie avatar Mar 29 '19 13:03 LeftPinkie

Use --date with partial dates, use --target with complete version.

http://docs.phinx.org/en/latest/commands.html#the-rollback-command

garas avatar Mar 29 '19 16:03 garas

This is not for the rollback command... this is for the migrate command.

If I do a phinx migrate --help, I get the following:

Help:
  The migrate command runs all available migrations, optionally up to a specific version
  
  phinx migrate -e development
  phinx migrate -e development -t 20110103081132
  phinx migrate -e development -d 20110103
  phinx migrate -e development -v

And when I do a phinx migrate -d 2002:

Migrating to version 20030201010101

 == 20020001010000 UserMigration: migrating
 == 20020001010000 UserMigration: migrated 0.0477s

 == 20030101010000 ProductMigration: migrating
 == 20030101010000 ProductMigration: migrated 0.0438s

 == 20030201010101 OrderMigration: migrating
 == 20030201010101 OrderMigration: migrated 0.0448s

LeftPinkie avatar Mar 29 '19 22:03 LeftPinkie

Both migrate and rollback has both options and should work same way.

I've compared how --date is handled:

  • rollback appends 0101000000 to 2012 to have full version;
  • migrate will just try to donew \DateTime('2012'), which fails.

Need to update to behave same.

garas avatar Mar 30 '19 11:03 garas

Watch out for the behaviour of version_order when set 'execution'.

This could account for the differences you think you may be seeing.

rquadling avatar Dec 19 '19 21:12 rquadling