rsim / oracle-enhanced

Oracle enhaced adapter for ActiveRecord
MIT License
544 stars 308 forks source link

Support Rails 7.1 ColumnDefinition validations (5) #2371

Open andynu opened 3 months ago

andynu commented 3 months ago

Support Rails 7.1 ColumnDefinition validations.

Rails commit e6da3ebd6c6 [1] introduces ColumnDefinition validations for the keywords used in database commands. This commit adds the additional keywords supported by this gem.

[1] https://github.com/rails/rails/commit/e6da3ebd6c65af23d134a9e01145f26600912008

Stacked on #2370

davinlagerroos commented 3 months ago

Something to consider: you can also define an adapter-specific valid_column_definition_options that calls super and adds the db-specific extras, e.g. https://github.com/umn-asr/oracle-enhanced/commit/211e3d164ac94fbdd4d165c4e7e16a96922b581e. This is closer to the pattern that the reference implementations for mysql and postgres in activerecord use. For example: https://github.com/rails/rails/pull/46178/files#diff-af97fb79600884bcb2fd1f3db7237c228f732d9a65f217949ede18525ec9a07d and https://github.com/rails/rails/pull/46178/files#diff-af97fb79600884bcb2fd1f3db7237c228f732d9a65f217949ede18525ec9a07d

andynu commented 3 months ago

Thanks @davinlagerroos, your suggestion of overriding TableDefinition#valid_column_definition_options is a better approach. I've updated this PR accordingly.

davinlagerroos commented 3 months ago

I'm glad that is helpful. Thanks for considering it!

I also wanted to add that I really like your general approach of slowly bumping the rails version with each PR so the build stays green along the way.