Welcome Guest, Not a member yet? Register   Sign In
Migration Class Names
#1

(This post was last modified: 08-03-2017, 04:57 AM by versalle88.)

I'm having an issue with CI 3 migrations and I'm wondering if anyone else has run into this and how they fixed it.

If I have the following migration file:

Code:
20121031100537_alter_blog.php

Then I have the following migration class:

PHP Code:
Migration_Alter_blog 

If I need to alter the blog table again, however:

Code:
20131031100537_alter_blog.php

It has the same class name:

PHP Code:
Migration_Alter_blog 

And because of the way CI load and initializes migrations, it'll throw a PHP error for redeclaring a class. Is there a way around this that anyone has found? If not, what's the best practice for handling these naming conflicts?

I've been able to get around it by adding the timestamp to the class name:

PHP Code:
Migration_Alter_blog_20131031100537 

But that requires a filename of:

Code:
20131031100537_alter_blog_20131031100537.php

Which just feels messy.

Any help or input is appreciated.
Reply


Messages In This Thread
Migration Class Names - by versalle88 - 08-03-2017, 04:45 AM
RE: Migration Class Names - by InsiteFX - 08-04-2017, 03:47 AM
RE: Migration Class Names - by versalle88 - 08-04-2017, 08:18 AM
RE: Migration Class Names - by kilishan - 08-04-2017, 07:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB