Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow double underscores in index names #136

Conversation

jeroenpf
Copy link
Contributor

See: #133 (comment)

When creating new tables in SQLite, original index names are prefixed with the table name. This is because unlike MySQL, SQLite does not allow identical index names across the database. Adding a table prefix ensures the index names are unique.

When running a show create table query, we restore the original index name by removing the table prefix. We split on double underscores but we did not take into account that the original index name can also contain __. This PR fixes an issue where we explode without a limit. We only want to explode on the first occurrence of __. Unit tests have been added to ensure this behavior.

Copy link
Member

@brandonpayton brandonpayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a solid change.

All that remains is the question about the null coalescing operator and minimum supported PHP version .

Copy link
Member

@brandonpayton brandonpayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, and the unit tests pass. Thanks, @jeroenpf!

@brandonpayton brandonpayton merged commit 40bdc78 into WordPress:develop Jul 26, 2024
8 checks passed
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.

3 participants