rubocop / rubocop-sequel

Code style checking for Sequel
MIT License
28 stars 14 forks source link

What's the reasoning behind ColumnDefault? #32

Closed fdr closed 1 year ago

fdr commented 1 year ago

https://github.com/rubocop/rubocop-sequel/blob/c15c2379444f931027ba39d8d44402fee92ef600/lib/rubocop/cop/sequel/column_default.rb#L7-L18

I'm a bit puzzled why this is a cop. I can imagine theoretical reasons, but not particularly practical ones, where the gains outweigh the costs (more nullable columns, being unable to use change blocks)

cyberdelia commented 1 year ago

It’s a remnant of older Postgres versions behaviour, see: https://www.2ndquadrant.com/en/blog/add-new-table-column-default-value-postgresql-11/

It might be time to drop it.

Also hi 👋🏻

fdr commented 1 year ago

Oh huh, I sort of expected it to rewrite, I actually didn't expect the fancy lazy behavior. I work with small databases, as you know.

Also, hello.

fdr commented 1 year ago

Interestingly, this rule doesn't match if you add null: false, does it only match when there is exactly default: whatever and nothing else? Given the original rationale (table rewrites), that seems a bit limited?