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

MySQL 'PARTITION' not recognized #258

Open
mindspin311 opened this issue Nov 12, 2013 · 4 comments
Open

MySQL 'PARTITION' not recognized #258

mindspin311 opened this issue Nov 12, 2013 · 4 comments
Milestone

Comments

@mindspin311
Copy link

Running:
scripts/modyllic dump --verbose mysql:host=server.nanigans.com:dbname=nan_rollup:username=foo:password=bar

Error: Unknown table flag Modyllic_Token_Bareword:'PARTITION', expected ENGINE, ROW_FORMAT, CHARSET or COLLATE while parsing SQL in nan_rollup.placement_performance_fivemin on line 78 at col 19:

...
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION<---HERE---> BY RANGE (to_days(fivemin))
(PARTITION p735233 VALUES LESS THAN (735233) ENGINE = InnoDB,
...

@iarna
Copy link
Contributor

iarna commented Nov 12, 2013

Parser, schema table class, diff and changeset table classes will have to be extended to support the PARTITION table options.

@mindspin311
Copy link
Author

I should have some time tomorrow to look into this. Thanks for pointing me in the correct places to look. I'll push out a commit if I can get this resolved.

@iarna
Copy link
Contributor

iarna commented Nov 13, 2013

The only complicating factor is that partition names, if not provided, will be inferred by MySQL. But that's something that's not any different then index naming. Overall it shouldn't be too bad, particularly since you don't have to pick it apart to do a diff as the alter command requires the complete partition declaration (just like with other table options).

@mindspin311
Copy link
Author

Did this in my sandbox to get PARTITION to be ignored while I work on this. May take a bit to fully understand all that's going on and the correct way to support this.

diff --git a/Modyllic/Parser.php b/Modyllic/Parser.php
index 7383436..61122b3 100644
--- a/Modyllic/Parser.php
+++ b/Modyllic/Parser.php
@@ -899,7 +899,11 @@ class Modyllic_Parser {

         // Load table flags
         while ( ! $this->peek_next() instanceOf Modyllic_Token_EOC ) {
-            $this->next();
+            // Ignore PARTITION FOR NOW.
+            $next = $this->next();
+            if ($next->token() == 'PARTITION') {
+                break;
+            }
             if ( $this->maybe_table_option() ) { }
             else {
                 throw $this->error("Unknown table flag ".$this->cur()->debug().", expected ENGINE, ROW_FORMAT, CHARSET or COLLATE");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants