ent icon indicating copy to clipboard operation
ent copied to clipboard

schema comment: load column comment, pass to atlas migration

Open CharlesGe129 opened this issue 3 years ago • 6 comments

Context: We uses atlas to generate versioned migration .sql files.

Problem: The columns' comments defined in schema are not generated to ent/migrate/schema.go. Thus, the .sql files generated by atlas doesn't contain column comments such as (name varchar(255) NOT NULL COMMENT "name of entity") in MySQL.

CharlesGe129 avatar May 20 '22 03:05 CharlesGe129

ummm..., I may need your help to pass the unit tests. I think those failed tests are not related to my changes.

CharlesGe129 avatar May 20 '22 07:05 CharlesGe129

Thanks for the contribution @CharlesGe129 🙏

PR looks fine to me, but integration tests fail. Can you please try to rebase your branch on master? If it won't work, I'll pull the changes and try this.

a8m avatar May 20 '22 10:05 a8m

Thanks for this PR @CharlesGe129 .

liasica avatar May 21 '22 02:05 liasica

I think I just rebased and updated this PR. Could you please check again? Not sure if I followed the right process.

CharlesGe129 avatar May 21 '22 13:05 CharlesGe129

@a8m Sorry to bother again. I'm unable to fix the integration tests but I think it might be unrelated to the code I changed. Could you please check what's going on and tell me how may I help to solve that? Thanks!

CharlesGe129 avatar May 25 '22 09:05 CharlesGe129

Related issues: #2550 #2217 #1627 #1546

CharlesGe129 avatar May 30 '22 09:05 CharlesGe129

The issue was resolved with: https://entgo.io/docs/schema-annotations#database-comments.

Update your Ent version to master, and check out this tweet to see an example: https://twitter.com/entgo_io/status/1607394587009589248

a8m avatar Dec 26 '22 15:12 a8m