ROM upsert and schema validation

Hi friends - wondering if I can get some 2c - relative noob to ROM

I was attempting to use relation.upsert with options but found that it wasn’t validating via the schema - which appears to be expected behaviour.

Instead as I was trying to get the upsert command working as I wanted/needed it to, and ended up reaching for a new custom command class extending from the ROM::SQL::Postgres::Commands::Upsert like so

  class UserUpsert < ROM::SQL::Postgres::Commands::Upsert
      relation :users
      register_as :upsert
      conflict_target :name
      update_statement  title: Sequel[:excluded][:title], email: Sequel[:excluded][:email]

    class UserRepository < Repository[:users]
      commands :upsert

Is there an easier/more idiomatic/more efficient way to do this that I’m just not seeing? Or is this fine the way it is?

Note the update_statement just uses the values being passed to it for those columns as the things to update with - unclear if there’s a better approach here, too

This is probably the best solution that I’m aware of.

Thanks kindly - wasnt sure if I was over-thinking it