Skip to content

Conversation

@MasterOdin
Copy link
Member

@MasterOdin MasterOdin commented Jun 4, 2024

This reverts commit 1187a5b.

From #2263 (comment):

When you provide a class name, then we hit this line to get the filename:

$fileName = Util::mapClassNameToFileName($className);

which per the comment:

* Turn migration names like 'CreateUserTable' into file names like
* '12345678901234_create_user_table.php' or 'LimitResourceNamesTo30Chars' into
* '12345678901234_limit_resource_names_to_30_chars.php'.

The tests for this function also back up the behavior here:

public function providerMapClassNameToFileName(): array
{
return [
['CamelCase87afterSomeBooze', '/^\d{14}_camel_case_87after_some_booze\.php$/'],
['CreateUserTable', '/^\d{14}_create_user_table\.php$/'],
['LimitResourceNamesTo30Chars', '/^\d{14}_limit_resource_names_to_30_chars\.php$/'],
];
}
/**
* @dataProvider providerMapClassNameToFileName
*/
public function testMapClassNameToFileName(string $name, string $pattern): void
{
$this->assertMatchesRegularExpression($pattern, Util::mapClassNameToFileName($name));
}

I think the capitalization that the docs was changed to might be a cakephp/migrations thing and not what phinx itself does?

@MasterOdin MasterOdin requested a review from dereuromark June 4, 2024 03:31
@dereuromark
Copy link
Member

Interesting. Might be then yeah
While it makes sense to have the name closer to the class name I guess this is a breaking change.
Feel free to merge

@MasterOdin
Copy link
Member Author

We could certainly make this a feature flag if it's desired behavior, though at that point, might be better to just go for filenames that adhere to PSR-4.

@MasterOdin MasterOdin merged commit a31003d into 0.x Jun 4, 2024
@MasterOdin MasterOdin deleted the docs-migration-create branch June 4, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants