ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
6.01k stars 267 forks source link

fix: an error that occurs when collation contains hyphen or dot #3229

Closed walkersumida closed 1 day ago

walkersumida commented 3 days ago

I noticed this error while using the ent. The collation of the migration file generated using migrate.NamedDiff in ent will be output without double quotation marks. The following error occurs when migrating the generated file.

ERROR:  syntax error at or near "-"
LINE 255: ...ALTER COLUMN "name" TYPE text COLLATE ja-x-icu;

The same error occurs if the collation contains a dot in the collation will also cause an error.

e.g. en_US.UTF-8

The version in which I found this error is a bit old, but I believe it reproduces in the latest version.

The fix for the cause of this error is L820. The other two were mechanically corrected because they were using COLLATE.

walkersumida commented 1 day ago

Thank you for your feedback and approval!