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

Tables get deleted/added even though they are in both databases #35

Open
chland opened this issue Apr 7, 2020 · 0 comments
Open

Tables get deleted/added even though they are in both databases #35

chland opened this issue Apr 7, 2020 · 0 comments

Comments

@chland
Copy link

chland commented Apr 7, 2020

I guess nobody is maintaining this repository anymore but I thought I would mention this bug and how to (probably) fix it.

When I run the script I sometimes end up with a migration-script that wants to delete tables that are still in both databases (I suspect that this could also happen the other way round where the migration wants to add an already existing table but so far I haven't encountered this particular situation).

The issue seems to be the base64_encode function in combination with the RegEx used to parse the table-definitions.

base64_encode (and base64_decode) are used in Parser.php to replace comments and default-values with their base64-encoded versions. My guess is that this is done to make parsing easier. Problem is, that base64_encode can produce a string containing a slash at the end. This makes it so that the regex will no longer be able to parse the table-definition and therefore the script will act strangely.

To "fix" this issue I replaced base64_encode/base64_decode with "custom" versions. I used the base64url_encode/base64_decode functions from the comments of the base64_encode-function on php.net - they basically just replace "+/" with "-_" - and this seems to fix the issue (DISCLAIMER: I didn't have the time to test that a whole lot but the few tests I did worked flawlessly).

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

No branches or pull requests

1 participant