sequelize-auto icon indicating copy to clipboard operation
sequelize-auto copied to clipboard

fix quote for default value

Open Aha00a opened this issue 2 years ago • 1 comments

I'm sorry and thank you for your sharing.

This PR is about default value.

I have field that uses single quote in default clause,

  `id` binary(16) NOT NULL DEFAULT unhex(replace(uuid(),'-','')) COMMENT 'identifier',

then it generates

      defaultValue: Sequelize.Sequelize.literal('unhex(replace(uuid(),'-',''))'),

then it causes error.

I've tried DEFAULT unhex(replace(uuid(),"-","")) , but MariaDB converts " to '.

I always think thanking you when I use sequelize-auto, please consider this.

Best regards.

Aha00a avatar Mar 16 '23 13:03 Aha00a

Besides the fix, this should also be considered: https://github.com/sequelize/sequelize-auto/issues/592

mariusa avatar Apr 22 '23 10:04 mariusa