sea-query icon indicating copy to clipboard operation
sea-query copied to clipboard

Resolving `IndexCreateStatement` not generating a valid query when no name is provided

Open mohs8421 opened this issue 2 years ago • 2 comments

On mysql systems, the IndexCreateStatement will generate a name, if no name was provided, resulting in always having a valid statement regarding the name.

PR Info

  • Closes https://github.com/SeaQL/sea-orm/discussions/1620

Bug Fixes

  • [x] The IndexCreateStatement does not work with mysql, if the name is not provided

mohs8421 avatar May 16 '23 21:05 mohs8421

Hey @mohs8421, nice stuffs!! Yes, then we always have a proper index name regardless.

@ikrivosheev do you still remember the "bug" where MySQL constraint / index name exceed the maximum length of MySQL's limit? Looks like @mohs8421 just truncate the long name.

well I didn't want to introduce an other source of error, so I just looked up the limit, although I know that this approach is still flawed because it could abreviate more properly, but then again, it is rather unlikely that somebody introduces an index, which exceeds this limit and have two of these indexes on the same table. In that case that user would still be able to manually specify a name, so nothing lost on that end.

mohs8421 avatar May 21 '23 17:05 mohs8421

Hey @mohs8421, nice stuffs!! Yes, then we always have a proper index name regardless.

@ikrivosheev do you still remember the "bug" where MySQL constraint / index name exceed the maximum length of MySQL's limit? Looks like @mohs8421 just truncate the long name.

@billy1624 hello! Yes, I do. Well, It's makes sense to truncate the long name...

ikrivosheev avatar Jul 27 '23 10:07 ikrivosheev