OnlineBuddies / Modyllic

MySQL database migrations, schema comparison, stored proc management made easy
BSD 2-Clause "Simplified" License
23 stars 9 forks source link

Can't handle 'bit' datatype #257

Open mindspin311 opened 10 years ago

mindspin311 commented 10 years ago

Running: scripts/modyllic dump --dialect=MySQL --verbose mysql:host=server.nanigans.com:dbname=nan_core:username=foo:password=bar --only=routines

Error: Expected reserved word, got Modyllic_Token_String:''0'' while parsing SQL in nan_core.api_errors on line 10 at col 43:

... notified bit(1) NOT NULL DEFAULT b'0'<---HERE--->, ...

Seems that it has a problem parsing the b'0'.

iarna commented 10 years ago

Modyllic can only currently parse unprefixed string literals. It does not support binary literals, nor hex literals, nor does it support character set prefixed literals (eg _latin1'abc'), nor does it support collation suffixes (eg 'abc' COLLATE latin1_german1_ci. Adding support for prefixes will require changes to the tokenizer– it will also likely require changes elsewhere too– the Modyllic_Token_String will need to carry metadata now, and users of it will need to maintain that metadata. Similarly emitters would need to be aware of this.

A half measure could be to look for bit field declarations explicitly and turn them into string literals. It'd look weird but the values would be correct.(eg, b'0' would become '\0')

mindspin311 commented 10 years ago

I'm not as worried about that. We can convert those to tiny ints. I'll have to look, but I don't think any of our massive (unalterable) tables have these types.