AnantLabs / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

warn about incompatible datatypes (MySQL errno: 150) #180

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,
I just spent some time googling what "errno: 150" in MySQL is. As it turned out 
I forgot to change the default TINYINT type of one of my indexes to matching 
INT type in other foreign key.

Would it be possible to change the default type from TINYINT to more usable INT 
type? Only 256 unsigned for key is really low number.

Or better yet, when exporting (generating SQL) the Designer should at least 
warn about incompatible datatypes.

Thanks,
Martin

Original issue reported on code.google.com by martin.meridius on 3 Mar 2014 at 7:39

GoogleCodeExporter commented 9 years ago
Hi Martin,

I hope I fixed this in 
http://code.google.com/p/wwwsqldesigner/source/detail?r=00a847e101f4690fa8ae123d
9ed1f44546858e46.

Original comment by ondrej.zara on 7 Mar 2014 at 7:39

GoogleCodeExporter commented 9 years ago
Hi Ondra,

thank you for the fix, although warning about incompatible datatypes would be 
still cool. ;)

Original comment by martin.meridius on 7 Mar 2014 at 7:38

GoogleCodeExporter commented 9 years ago
Can you please elaborate a bit? I am not sure what types are incompatible 
and/or whether a FK value can be - in some circumstances - of a different type 
than the PK.

Original comment by ondrej.zara on 10 Mar 2014 at 12:01

GoogleCodeExporter commented 9 years ago
That's the thing, AFAIK you can't set up foreign key between two keys of 
different type. Not even two numeric types as Integer and Tinyint are 
compatible. And without warning during exporting and/or saving, you'll notice 
that after you ran that query through database.

Original comment by martin.meridius on 10 Mar 2014 at 11:11

GoogleCodeExporter commented 9 years ago
So to sum it up, simple checking if connected keys are of the same type upon 
saving/exporting (generating SQL) would suffice. If they have different type, 
the app would alert user. And this behavior could be optional.

Original comment by martin.meridius on 10 Mar 2014 at 11:16

GoogleCodeExporter commented 9 years ago
Sounds like a good idea to me.

Original comment by ondrej.zara on 15 Mar 2014 at 9:17

GoogleCodeExporter commented 9 years ago

Original comment by ondrej.zara on 15 Mar 2014 at 9:18