Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Migration class name conflict
  • I assume I'm doing something wrong with my migration naming: Let's say I have 2 versions. The files are named
    001_example.php
    002_example.php The class name in both the files is "Example".
    If I start at version zero and run php oil refine migrate, it throws an error saying that the class Example has already been declared. Makes sense, because both files are in the same namespace and are being called in the same session. So how do I name the subsequent classes to fix the above problem? I can migrate one version at a time just fine, but of course it would be nice to be able to run the full set of migrations at once. Thanks
  • The obvious answer is: make sure the classnames are unique.
  • Well of course. I tried renaming the second migration's class name to "Example2", but then it doesn't get run.
  • Maybe it thinks you're already at 2 due to the previous failure?
  • Okay, my bad I was going off someone else's report of "php oil refine migrate" from version 0 to version 2 not working with the "Example2" naming schema. However, migrating down does not work. I'm getting
    Error - Migration "002_example.php" does not contain expected class "Fuel\Migrations\Example"
    
    (because it's named Example2)
    So either oil has some work to be done or I'm still doing something incorrectly. EDIT: My bad again. The full migration from version 0 runs without error, and says it got to version 2 successfully. However, the second set of migrations was NOT run. It has to be named the same as the first migration for it to run. Are there any examples out there of multiple versions of migrations done properly?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion